Logic puzzles

This forum is for discussion about anything else.
User avatar
Norinel
Norinel
Not Voting (3)
User avatar
User avatar
Norinel
Not Voting (3)
Not Voting (3)
Posts: 1684
Joined: March 2, 2003
Location: My computer

Logic puzzles

Post Post #0 (ISO) » Sun Nov 09, 2003 7:54 am

Post by Norinel »

The birthday thread has degenerated into off-topic logic puzzle discussion, so I thought I'd split it off into a new one before things got too out of control. Puzzles from there:
shadyforce wrote:
You are in a dungeon and trying to escape. You walk down a hall and come across 2 large and very ugly guards who initially remain silent. Each guard is standing beside a door, so there is a door to the left and a door to the right. The guards are not blocking the doors, just there for decoration it seems, until you notice a sign on the wall:
  • The exit to the dungeon is behind one of these doors but which one... Choose correctly and you will win your freedom, choose the wrong one and you will never escape. The guards you see before you are identical twins by the name of Fibkin and Truthkin. Truthkin will always give you the correct answer to your question whereas Fibkin will always give the opposite answer.

    You may choose one of the guards and ask him one question.
How can you guarantee your freedom.
CaptainBlicero wrote:In the alternate version, the owner of the labyrinth has made 100 clones each of Truthkin and Fibkin, and two are randomly assigned to guard the exit. In other words, you might be facing 2 Truthkins, 2 Fibkins, or a Truthkin and a Fibkin. How can you figure out the correct door? In this situation, you are allowed to ask one of the guards two yes/no questions.
Norinel wrote:There are ten people, nine liars and one truth-teller. (The liars know who the truth-teller is) Given three yes or no questions, each directed at one particular person (But it doesn't have to be the same one for all three), come up with an infallible method for finding the truth-teller.
Kerplunk wrote:
Cheating wives

In a city of the Sultan there was a problem. There were 40 wives in the city who were cheating their husbands. And everyone in the city knew which wife, only the husbands didn’t know that their wife was cheating. The Sultan decided to do something about it.
He wrote out a proclamation which said that all husbands of the cheating wives may kill their wives in the night, but only if they’re sure of it. It didn’t how many wives, only that there were wives who cheated their husband.
On the first day nothing happened, on the second day still nothing, a whole month went by and nothing happened. The councellors said to the Sultan that it wasn’t such a good idea. But the Sultan said that he had every confidence in his people. An he was right.
One night suddenly all the cheating wives were killed by their husbands, and strangely enough only the cheating wives.

At what night was this and how was this possible?
User avatar
Stewie
Stewie
Mafia Scum
User avatar
User avatar
Stewie
Mafia Scum
Mafia Scum
Posts: 2567
Joined: July 16, 2003
Location: Canada
Contact:

Post Post #1 (ISO) » Sun Nov 09, 2003 8:40 am

Post by Stewie »

are we allowed to discuss the answers here? and were wa this discussion in the first place?

EDIT: oh, I just figured out where it was discussed in the first place. Can we say what we think the answer is here?
User avatar
Norinel
Norinel
Not Voting (3)
User avatar
User avatar
Norinel
Not Voting (3)
Not Voting (3)
Posts: 1684
Joined: March 2, 2003
Location: My computer

Post Post #2 (ISO) » Sun Nov 09, 2003 10:14 am

Post by Norinel »

I don't believe there are any rules per se, just try not to spoil people's enjoyment too much without spoiler tags or whatever.
User avatar
Stewie
Stewie
Mafia Scum
User avatar
User avatar
Stewie
Mafia Scum
Mafia Scum
Posts: 2567
Joined: July 16, 2003
Location: Canada
Contact:

Post Post #3 (ISO) » Sun Nov 09, 2003 2:12 pm

Post by Stewie »

spoiler marks... that reminds me, yesterday a guy in another forum worte something like "Why [mayor event here] in matrix revolutions?" in all caps as topic title. I just wanted to kill the bastard. Anyways, can it be for kerplunk's wife thing that the most obious answer is the correct one, and that the day in which all the wifes are killed is the one that each husband catches his wife doing it with the other guy? It's not likely, but worth a shot. Pm me if that was the answer, Kerplunk. And when I first read the topic title, I remembered another one, but now I forgot, so I'll try to remember.
User avatar
Cadmium
Cadmium
Twentythreeth
User avatar
User avatar
Cadmium
Twentythreeth
Twentythreeth
Posts: 1162
Joined: May 1, 2002
Location: Netherlands, the (Utrecht)

Post Post #4 (ISO) » Sun Nov 09, 2003 9:56 pm

Post by Cadmium »

If you're interested in these kind of things, you guys should just visit the Grey Labyrinth.

Watch out for chainsaws though :).
"OH MY GOD, Cadmium! I can make rye bread! You must be innocent, I'll do whatever you tell me!" exclaims Mackay excitedly. - Jeep, Mini Game 9
User avatar
Wacky
Wacky
Goon
User avatar
User avatar
Wacky
Goon
Goon
Posts: 866
Joined: July 16, 2003
Location: Sydney, Australia

Post Post #5 (ISO) » Mon Nov 10, 2003 3:16 am

Post by Wacky »

You can find the equivalent q and answer of the cheating wives problem by googling for "william wu". He runs some kind of puzzle site which I don't go to anymore (and deleted the bookmark)

And the truth/fibkin q and answer.
...whatever remains, however improbable, must be the truth.
User avatar
mathcam
mathcam
Captain Observant
User avatar
User avatar
mathcam
Captain Observant
Captain Observant
Posts: 6116
Joined: November 22, 2002

Post Post #6 (ISO) » Mon Nov 10, 2003 4:25 am

Post by mathcam »

To move this puzzle over...

Monty Hall is definitely another cool problem. Here's a simple also very cool related one.
mathcam wrote:A guy comes up to you with two envelopes with money, one has, say, X dollars, and the other has 2X dollars. He gives you one of the envelopes, you open it, count the money, and then he offers you a chance to switch envelopes if you want. Do you take it? (Say, for example, the envelope you opened had 50 bucks in it).
PolarBoy wrote: Well there are basically two possibilities. Either you lose $25 or gain $50(the other envelope is either going to have $25 or $100 in it). I suppose the best guess would be to switch, as you can't lose everything, but you stand to gain 100% if you're lucky.
Okay, good. Switching is the best answer...you're expected profit is .5*25+.5*100=$62.50, where as the expected profit of keeping the $50 is quite clearly $50.

So the first step is done. Now, consider the fact that you didn't need to know the value was $50. This would have worked for any postive integer (or real number, but let's keep this imaginable). But since it worked for any positive integer, you didn't even need to open the envelope in the first place, right? Your strategy should be to always switch.

The next thought coming through your head should be: WHAAAAA? He gives me one envelope at random, and my optimal strategy is to always switch? How can that possibly be right? Continuing this scenario, if he let you switch envelopes back, it would still be optimal for you to do so.

So your optimal strategy seems to be switching envelopes back and forth until the end of time. Your job is to figure out what's going on.

Cam
User avatar
mathcam
mathcam
Captain Observant
User avatar
User avatar
mathcam
Captain Observant
Captain Observant
Posts: 6116
Joined: November 22, 2002

Post Post #7 (ISO) » Mon Nov 10, 2003 4:26 am

Post by mathcam »

p.s. I think you won't find this one on puzzle sites unless some like-minded mathematician has posted it there.

Cam
User avatar
Kerplunk
Kerplunk
Mafia Scum
User avatar
User avatar
Kerplunk
Mafia Scum
Mafia Scum
Posts: 1272
Joined: July 15, 2003
Location: Grûn, The Netherlands

Post Post #8 (ISO) » Mon Nov 10, 2003 7:04 am

Post by Kerplunk »

*thinking about Norinel's problem and Cam's*

'Another' solution to the Monty Hall/quizmaster problem:

You have to switch when you are standing behind a 'false' door. The chance of standing behind a false door is 2/3. So, if you switch, the chance of coming from a false door and thus going to the right door is 2/3. Not switching is only the right thing to do, if standing behind the right door and that chance is 1/3.
Has your mafiagame lasted for only a few days or maybe it dragged on and on and on? Check the [url=http://www.mafiascum.net/wiki/index.php?title=Records]Records page[/url] on the wiki to see if it is a record!
Quailman
Quailman
Mafia Scum
Quailman
Mafia Scum
Mafia Scum
Posts: 1372
Joined: October 7, 2002
Location: Spring, Texas

Post Post #9 (ISO) » Mon Nov 10, 2003 8:36 am

Post by Quailman »

For the cheating wives:

Each man either knows about the total number (which does not include his wife), or one less than the total (because his wife is cheating). He also knows that each other man knows either the same number of cheaters that he does, or one more, or one less.

If one woman was cheating, then her husband would have been the only man not to know any cheating women, and would have killed her on the first night. If no woman was killed the first night, then the two men who only knew of one women would kill their wives, because they now know that everyone knew of at least one cheater. Since they themselves only know of one, their wives must be the second cheater that all but the two of them know. Or if no one died the second night, then the three men who only know of two women would kill their wives, and so on. So on the 40th night, the 40 men who know of 39 cheating women who did not die the night before will each kill their wives, because they now know that more than 39 women are cheating.
User avatar
Norinel
Norinel
Not Voting (3)
User avatar
User avatar
Norinel
Not Voting (3)
Not Voting (3)
Posts: 1684
Joined: March 2, 2003
Location: My computer

Post Post #10 (ISO) » Mon Nov 10, 2003 11:07 am

Post by Norinel »

Mathcam, I know I've read about it in some old Martin Gardner collection, but I can't recall the particular reasoning that counteracts the paradox. Thanks for putting one up I didn't already know the answer to (Though I did at some point).
Strong Bad
Strong Bad
Townie
Strong Bad
Townie
Townie
Posts: 27
Joined: October 20, 2003
Location: Strong Badia, Pop: Tire
Contact:

Post Post #11 (ISO) » Mon Nov 10, 2003 11:20 am

Post by Strong Bad »

mathcam, the optimal strategy is clearly to keep switching envelopes until the other guy gets bored and leaves, then you get both, and earn between 1.5 times the ammount in envelope and 3 times the amount in the envelope.
Holy crap! It's [url=http://mafiascum.net/forum/viewtopic.php?p=18814#18814]Homestar Runner Mafia[/url]!
Antrax
Antrax
mith owns mafiascum.net
Antrax
mith owns mafiascum.net
mith owns mafiascum.net
Posts: 313
Joined: April 2, 2002
Location: Israel
Contact:

Post Post #12 (ISO) » Mon Nov 10, 2003 11:34 am

Post by Antrax »

Re: mathcam,

I don't agree with the expectancy calculation here. Two envelopes, one with n and the other with 2n money. You're holding something that has 50% of being the n envelope, and 50% of being the 2n, together we have an expectancy of 1.5n, and it won't change if you switch.
Antrax
"No matter it's right and wrong. It's not your turn to criticise me!" - Shing Kwun, "The Evil Cult"
User avatar
Norinel
Norinel
Not Voting (3)
User avatar
User avatar
Norinel
Not Voting (3)
Not Voting (3)
Posts: 1684
Joined: March 2, 2003
Location: My computer

Post Post #13 (ISO) » Mon Nov 10, 2003 1:22 pm

Post by Norinel »

I thought about that argument as well, but it seems like since n, from the perspective of the person who's opened one envelope, could be two different things, you can't treat it as a constant in that way.
CaptainBlicero
CaptainBlicero
ARRRRRRRR!
CaptainBlicero
ARRRRRRRR!
ARRRRRRRR!
Posts: 657
Joined: August 30, 2002
Location: Big Timber, Montana

Post Post #14 (ISO) » Mon Nov 10, 2003 1:34 pm

Post by CaptainBlicero »

mathcam wrote:Now, consider the fact that you didn't need to know the value was $50. This would have worked for any postive integer (or real number, but let's keep this imaginable). But since it worked for any positive integer, you didn't even need to open the envelope in the first place, right? Your strategy should be to always switch.

Add the word "once" to the end of the last sentence. If you take the first envelope and open it, then you see that it contains X dollars. Keeping that envelope gives you an expected payoff of $X. Switching envelopes gives you an expected payoff of (.5*.5X) + (.5*2X) = $1.25X. Switching again obviously reduces your payoff back to $X. Therefore, it wouldn't be optimal to switch back.

If you never open the envelope, but to just pick one at random (or continually keep switching and just stop at a random point), your payoff is (.5*X) + (.25*.5X) + (.25*2X) = $1.125X, not $1.5X. Obviously, the best strategy is still to switch once, but it's better to pick an envelope at random than to simply keep the one you first open. Very interesting.
User avatar
mathcam
mathcam
Captain Observant
User avatar
User avatar
mathcam
Captain Observant
Captain Observant
Posts: 6116
Joined: November 22, 2002

Post Post #15 (ISO) » Wed Nov 12, 2003 4:12 am

Post by mathcam »

Antrax: A little confusion here, which Norinel pretty much explained. Your "n" is the amount of money in the envelope you're currently holding. There is a 100 percent chance that the amount of money in your envelope is "n", so that is the expected value of not switching.

The expected value of
switching
is half of (n/2) plus half of (2n), i.e. 1.25n.

I think working out the case where you get the envelope with $50 in it should convince you.

CB: You're quite right that you're payoff goes back to X, but note that the same argument still applies. After you've switched, call the amount of money in your envelope Y. Then the other envelope either has Y/2 or 2Y again, giving us an expected value of 1.25Y to switch back, thus making it optimal. Weird, huh?
Obviously, the best strategy is still to switch once, but it's better to pick an envelope at random than to simply keep the one you first open. Very interesting.
But yeah, this is the more important question. It's not even just "the first one you open". It's the first one you're handed. Whichever one you're handed, the theory says you should take the other one, which is clearly nonsensical. There's something definitely fishy going on, but what?

Cam
User avatar
CurtainDog
CurtainDog
Goon
User avatar
User avatar
CurtainDog
Goon
Goon
Posts: 165
Joined: January 18, 2003
Location: Sydney!

Post Post #16 (ISO) » Wed Nov 12, 2003 2:04 pm

Post by CurtainDog »

I think the problem is that n is unbounded, therefore your expected payoff before looking at either envelope is infinite.

As soon as you put a bound on the value of n you have to consider the possibility that the envelope you hold has the 'maximum amount'. Because swapping if you have the maximum will always lose you half of what you had this will reduce your expected gain from swapping envelopes to 0, i.e. there is no advantage to swapping.

The sum to infinity of 1/2^n is 2. So if you lost half the maximum (which is 1 in this equation) you'd lose a quarter of the potential value of all the envelopes. This takes care of the phantom .25 'advantage' you gain by swapping.

The net result is kind of like a monty hall situation with an infinite number of doors. There would be no point in swapping regardless of how many other doors have been opened.
User avatar
Dourgrim
Dourgrim
Yep. Again.
User avatar
User avatar
Dourgrim
Yep. Again.
Yep. Again.
Posts: 875
Joined: February 12, 2003
Location: Elkhorn, WI
Contact:

Post Post #17 (ISO) » Wed Nov 12, 2003 2:22 pm

Post by Dourgrim »

DISCLAIMER: I'm really bad at theoretical logic puzzles like these, so take my comment with a grain of salt.

So if, in the case of the envelopes, it is always advantageous to switch between the two envelopes (and an infinite number of times, at that), doesn't that also translate to it being advantageous to not bother switching at all? I mean, since the other envelope is statistically better, you're always going to go for it... but then, the second time around, you're statistically better off going back to the envelope you had the first time, et cetera. Why bother switching at all if you're going to cycle through the same two envelopes over and over?
[size=75]The point of the journey is not to arrive...[/size]
CaptainBlicero
CaptainBlicero
ARRRRRRRR!
CaptainBlicero
ARRRRRRRR!
ARRRRRRRR!
Posts: 657
Joined: August 30, 2002
Location: Big Timber, Montana

Post Post #18 (ISO) » Wed Nov 12, 2003 2:24 pm

Post by CaptainBlicero »

mathcam wrote:CB: You're quite right that you're payoff goes back to X, but note that the same argument still applies. After you've switched, call the amount of money in your envelope Y. Then the other envelope either has Y/2 or 2Y again, giving us an expected value of 1.25Y to switch back, thus making it optimal. Weird, huh?
Hm. It's been a few years since I took a probability course, but I'm pretty sure there's some special steps you have to take when looking at the expected value of an unknown quantity like Y. I can't point out precisely what's wrong though.
mathcam wrote:t's not even just "the first one you open". It's the first one you're handed. Whichever one you're handed, the theory says you should take the other one, which is clearly nonsensical.
No, that's not what I'm saying. I'm saying you should always take the envelope that has the unknown quantity.

Think about it this way: The man performs this test on you a sufficient amount of times for the probabilities to work out near-perfectly (for simplicity's sake, let's say 100 times is enough).
Each time, the envelope you first open has $50 in it. What is the optimal strategy?
E[always stay] = $50*100 = $5,000
E[always switch] = $100*50 + $25*50 = $6,250
E[switch half the time, stay half the time] = $50*50 + $100*25 + $25*25 = $5,625

This matches with the results I had earlier.
User avatar
mathcam
mathcam
Captain Observant
User avatar
User avatar
mathcam
Captain Observant
Captain Observant
Posts: 6116
Joined: November 22, 2002

Post Post #19 (ISO) » Thu Nov 13, 2003 4:05 am

Post by mathcam »

Dourgrim wrote:So if, in the case of the envelopes, it is always advantageous to switch between the two envelopes (and an infinite number of times, at that), doesn't that also translate to it being advantageous to not bother switching at all?
This is essentially the paradox before us. Our expected value calculation shows that switching is always right, yet common sense dictates that this strategy is absurd.
No, that's not what I'm saying. I'm saying you should always take the envelope that has the unknown quantity.
Yes, and that is true for the case where you opened the envelope and found $50. But I'm saying the next interesting generalization is that the "always switch" result still holds if you didn't open the envelope at all. You're simply handed the envelope with some unknown amount of money in it, you're not allowed to open it, but you
are
allowed to switch envelopes if you want. Our calculation above shows that it's always right to switch, but after you've switched, the same argument holds again!

But yes, the proverbial nail has been hit on the head:

[quote="CurtainDog"I think the problem is that n is unbounded, therefore your expected payoff before looking at either envelope is infinite.[/quote]

We have that the expected value of staying is X, and the expected value of switching is 1.5X. This is only a contradiction of common sense if 1.5X>X. However, X is infinite. To convince yourself of this, if it weren't infinite, what would it be? A million dollars? There sure are a lot more numbers bigger than a million than smaller than million, so there's no way that could be right. Same argument for a billion, a trillion, etc.

So the expected value of staying or switching is infinite. CurtainDog is also right that as soon as we restrict the problem to a finite set of possible values the paradox disappears.

Hope that was enjoyable...I'll let you know if I find more.

Cam
User avatar
gslamm
gslamm
Goon
User avatar
User avatar
gslamm
Goon
Goon
Posts: 265
Joined: July 14, 2003
Location: NW AR, USA

Post Post #20 (ISO) » Wed Nov 19, 2003 2:51 am

Post by gslamm »

One hundred ants are placed on a stick one meter long. Each
ant begins to travel either to the left or to the right at a constant
speed of one meter per minute. When two ants meet, they bounce
off and reverse direction while maintaining their speed. When an
ant reaches either end of the stick it falls off.
What is the longest amount of time one must wait to be sure that
the stick is completely ant-free?
[size=84]"Hmm, wow.. I'll just sit back and watch the stupidity continue to unfold.. "- genku Mixed Theme [/size]
User avatar
mathcam
mathcam
Captain Observant
User avatar
User avatar
mathcam
Captain Observant
Captain Observant
Posts: 6116
Joined: November 22, 2002

Post Post #21 (ISO) » Wed Nov 19, 2003 5:52 am

Post by mathcam »

Good ol' Macpow.

Cam
User avatar
gslamm
gslamm
Goon
User avatar
User avatar
gslamm
Goon
Goon
Posts: 265
Joined: July 14, 2003
Location: NW AR, USA

Post Post #22 (ISO) » Wed Nov 19, 2003 6:51 am

Post by gslamm »

macpow? MSRI !
Last edited by gslamm on Wed Nov 19, 2003 9:57 am, edited 1 time in total.
[size=84]"Hmm, wow.. I'll just sit back and watch the stupidity continue to unfold.. "- genku Mixed Theme [/size]
User avatar
mathcam
mathcam
Captain Observant
User avatar
User avatar
mathcam
Captain Observant
Captain Observant
Posts: 6116
Joined: November 22, 2002

Post Post #23 (ISO) » Wed Nov 19, 2003 8:26 am

Post by mathcam »

I think something like "Macallister Problem of the Week." I think that was last week's problem, or maybe the week before's.

Cam
User avatar
CurtainDog
CurtainDog
Goon
User avatar
User avatar
CurtainDog
Goon
Goon
Posts: 165
Joined: January 18, 2003
Location: Sydney!

Post Post #24 (ISO) » Wed Nov 19, 2003 1:23 pm

Post by CurtainDog »

Hehe... bouncing ants. It'd be so much easier if they just walked around eachother :roll:
Post Reply

Return to “General Discussion”