Logical puzzles

All non-Go discussions should go here.
illluck
Lives in sente
Posts: 1223
Joined: Sun Apr 25, 2010 5:07 am
Rank: OGS 2d
GD Posts: 0
KGS: illluck
Tygem: Trickprey
OGS: illluck
Has thanked: 736 times
Been thanked: 239 times

Re: Logical puzzles

Post by illluck »

I'm confused at the solution:

Especially "The prisoners all go free if the longest loop in the permutation contains at most 50 boxes." As far as I can see that is not true - imagine 50 2-box loops. Am I misunderstanding the solution?


Edit after 1 min to clarify:
I think (if I didn't fail at reading :p) that for some reason the solution assumes that the prisoner's name will be in the first loop he selects, and since I can't see how that is true the conclusion doesn't hold.
User avatar
flOvermind
Lives with ko
Posts: 295
Joined: Wed Apr 21, 2010 3:19 am
Rank: EGF 4 kyu
GD Posts: 627
Location: Linz, Austria
Has thanked: 21 times
Been thanked: 43 times

Re: Logical puzzles

Post by flOvermind »

illluck wrote:
I think (if I didn't fail at reading :p) that for some reason the solution assumes that the prisoner's name will be in the first loop he selects, and since I can't see how that is true the conclusion doesn't hold.


Assuming the initial cycle of the prisoner is shorter than 50. What are the prisoners supposed to do after the end of the cycle? Start another cycle at a random box?

That's not a question. That's a hint :P
Try to go slowly through all the steps again ;)
User avatar
daniel_the_smith
Gosei
Posts: 2116
Joined: Wed Apr 21, 2010 8:51 am
Rank: 2d AGA
GD Posts: 1193
KGS: lavalamp
Tygem: imapenguin
IGS: lavalamp
OGS: daniel_the_smith
Location: Silicon Valley
Has thanked: 152 times
Been thanked: 330 times
Contact:

Re: Logical puzzles

Post by daniel_the_smith »

illluck wrote:I'm confused at the solution:

Especially "The prisoners all go free if the longest loop in the permutation contains at most 50 boxes." As far as I can see that is not true - imagine 50 2-box loops. Am I misunderstanding the solution?



Remember that by definition:
A loop contains the prisoner's number. In fact, it is always the last box in the loop.

For much the same reason you always find something in the last place you look...
That which can be destroyed by the truth should be.
--
My (sadly neglected, but not forgotten) project: http://dailyjoseki.com
User avatar
Redundant
Lives in sente
Posts: 924
Joined: Thu Apr 22, 2010 3:00 pm
Rank: lazy
GD Posts: 0
KGS: redundant/silchas
Tygem: redundant
Wbaduk: redundant
DGS: redundant
OGS: redundant
Location: Pittsburgh
Has thanked: 45 times
Been thanked: 103 times

Re: Logical puzzles

Post by Redundant »

Just to chime in, the technical term for what you're calling a loop is an orbit.
illluck
Lives in sente
Posts: 1223
Joined: Sun Apr 25, 2010 5:07 am
Rank: OGS 2d
GD Posts: 0
KGS: illluck
Tygem: Trickprey
OGS: illluck
Has thanked: 736 times
Been thanked: 239 times

Re: Logical puzzles

Post by illluck »

Ah, I think I (sort of) understand now. Thanks for the hints!
Bill Spight
Honinbo
Posts: 10905
Joined: Wed Apr 21, 2010 1:24 pm
Has thanked: 3651 times
Been thanked: 3373 times

Re: Logical puzzles

Post by Bill Spight »

illluck wrote:I'm confused at the solution:

Especially "The prisoners all go free if the longest loop in the permutation contains at most 50 boxes." As far as I can see that is not true - imagine 50 2-box loops. Am I misunderstanding the solution?


Edit after 1 min to clarify:
I think (if I didn't fail at reading :p) that for some reason the solution assumes that the prisoner's name will be in the first loop he selects, and since I can't see how that is true the conclusion doesn't hold.


Hint:

Traverse the loop backwards. :)
The Adkins Principle:
At some point, doesn't thinking have to go on?
— Winona Adkins

Visualize whirled peas.

Everything with love. Stay safe.
User avatar
Gresil
Lives with ko
Posts: 206
Joined: Tue Apr 20, 2010 11:03 pm
Rank: mid-SDK
GD Posts: 495
KGS: Gresil
Location: Finland
Has thanked: 29 times
Been thanked: 9 times

Re: Logical puzzles

Post by Gresil »

Violence wrote:Here's a fun one for you all.

A teacher says: I'm thinking of two natural numbers bigger than 1. Try to guess what they are.
The first student knows their product and the other one knows their sum.
First: I do not know the sum.
Second: I knew that. The sum is less than 14.
First: I knew that. However, now I know the numbers.
Second: And so do I.
What were the numbers?



My guess is (edit) 5 and 8.

The product has multiple factorizations where neither number is 1, and exactly one of them matches the condition that the sum of the factors is less than 14.

The only way I can pin it down is an exhaustive search.

12: 3*4, 2*6, no
18: 3*6, 2*9, no
20: 4*5, 2*10, no
24: 4*6, 8*3, no
30: 5*6, 10*3, no
36: 4*9, 3*13, perhaps


edit: I looked at Averell's solution. Are you sure it's correct? There's something I'm not getting if it is.


edit 2: whoops, I missed 36 = 6*6.

40: 5*8, 4*10. So it's 5 and 8.
So you've got an eye?
That don't impress me much
averell
Dies in gote
Posts: 61
Joined: Tue May 04, 2010 7:14 am
GD Posts: 0
Has thanked: 57 times
Been thanked: 19 times

Re: Logical puzzles

Post by averell »

Gresil wrote:
edit: I looked at Averell's solution. Are you sure it's correct? There's something I'm not getting if it is.


I am somewhat sure, i checked my solution and it fits but i'm prone to mistakes calculating in my head.
Anyway, in your solution:
Second: I knew that. The sum is less than 14.
First: I knew that. However, now I know the numbers.

Now, you have 5 and 8, 40 the product, so product guy only knows it's either 2 * 20, 4 * 10, or 8 * 5, but because only 8*5 is less than 14, he is lying when he says he knew that. With 2 * 9 = 3 * 6 both sums are less than 14.
robinz
Lives in gote
Posts: 414
Joined: Thu Sep 16, 2010 3:40 am
Rank: KGS 9k
GD Posts: 0
KGS: robinz
Location: Durham, UK
Has thanked: 95 times
Been thanked: 15 times

Re: Logical puzzles

Post by robinz »

averell is quite right - 2 and 9 is the solution. (Which I had worked out for myself while away from the forum - I wasn't surprised to see it had been solved by someone else in the meantime :))

Basically, 11 is the only number less than 14 for which all pairs which sum to it have a product which has (at least) two different non-trivial factorisations. And, of the pairs which sum to 11, 2 and 9 is the only one for which all possible pairs of factors for the product sum to less than 14.
User avatar
Stefany93
Lives with ko
Posts: 248
Joined: Wed Jun 23, 2010 12:39 pm
Rank: KGS 8k
GD Posts: 0
KGS: Azumi93
Online playing schedule: When I am in a mood for Go :D
Location: Arkansas, USA
Has thanked: 193 times
Been thanked: 21 times
Contact:

Re: Logical puzzles

Post by Stefany93 »

I guess it will be take me a couple of years to solve it. I didn't know I am so smart :o
entropi
Lives in gote
Posts: 493
Joined: Wed Apr 21, 2010 6:20 am
Rank: sdk
GD Posts: 175
Has thanked: 80 times
Been thanked: 71 times

Re: Logical puzzles

Post by entropi »

HermanHiddema wrote:
tj86430 wrote:I would like to see the solution, please. If you don't want to post it here, pm me.


As requested, the solution:

On the evening in advance, the prisoners get together and assign a number (1 through 100) to each prisoner. Each prisoner memorizes the numbers of all prisoners. This means that each box is now virtually marked with a prisoner name on the outside. It also means that the piece of paper in any box can now be seen as a reference to a box. Effectively, the boxes have become a permutation of the numbers 1-100, referencing each other.

The next day, each prisoner enters the room and opens the box with his own number on it. If it contains his name, he's done. If it contains another prisoners name, he next opens that prisoners box. He repeats this procedure, following the references to new boxes, until he has found his name, or until his 50 tries are up.

Each permutation is guaranteed to contain loops, and every box is guaranteed to be part of exactly one loop. The shortest loops are when a box points to itself (loop of length 1) or when two boxes point to each other (length 2). The longest possible loop has length 100 (each box points to a new box, until the 100th box in the sequence points back to the first).

The prisoners all go free if the longest loop in the permutation contains at most 50 boxes. The chance of that is 1 - ln(2), which is about 31.18%

Background article: http://www.sciencenews.org/view/generic ... s_in_Boxes


The strategy is pretty clear. Ok I accept, if it works it works :)

But I still have two problems with it:

1- I still don't get how you calculate 1-ln(2). It is not at all apparent for me that the probability of the longest loop not exceeding 50 is 1-ln(2). But anyway that's pure mathematics. My next problem is more important, which is:

2- Is there a proof that this strategy gives the highest survival probability?

While understanding the strategy and how it works, I must admit that I don't get the feeling of it. Why would creating such a "linked list" maximise the survival probability?
Which information do you exploit for increasing the probability?
If you say no, Elwood and I will come here for breakfast, lunch, and dinner every day of the week.
User avatar
HermanHiddema
Gosei
Posts: 2011
Joined: Tue Apr 20, 2010 10:08 am
Rank: Dutch 4D
GD Posts: 645
Universal go server handle: herminator
Location: Groningen, NL
Has thanked: 202 times
Been thanked: 1086 times

Re: Logical puzzles

Post by HermanHiddema »

entropi wrote:2- Is there a proof that this strategy gives the highest survival probability?


Not that I know of, but obviously I also do not know a better strategy.

While understanding the strategy and how it works, I must admit that I don't get the feeling of it. Why would creating such a "linked list" maximise the survival probability?
Which information do you exploit for increasing the probability?


For each individual prisoners, the chance of finding their name has not increased (nor has it decreased). Each prisoner still has 50% chance of finding their name. The strategy just ties them together. So now either all the prisoners in the loop fail, or none of them fail (depending on the loop length). And by doing that, we eliminate the possibility that fewer than 51 prisoners will fail. If the longest loop is at least 51, then all the prisoners in that loop will fail. If the longest is 50 or less, nobody fails. So all the cases of 1,2,3,4,....,47,48,49,50 prisoners failing have suddenly been eliminated.

At the same time, all the cases of 51,52,53,54....,97,98,99,100 prisoners failing have had their chance increased. With a random strategy, the chance of all prisoners failing is as astronomical as all of them succeeding. With this strategy, the chance of all prisoners failing is exactly 1%. Here too, the strategy ties the prisoners together in sharing their fate.
User avatar
cyclops
Lives in sente
Posts: 801
Joined: Mon May 10, 2010 3:38 pm
Rank: KGS 7 kyu forever
GD Posts: 460
Location: Amsterdam (NL)
Has thanked: 353 times
Been thanked: 107 times
Contact:

Re: Logical puzzles

Post by cyclops »

entropi wrote:
1- I still don't get how you calculate 1-ln(2). It is not at all apparent for me that the probability of the longest loop not exceeding 50 is 1-ln(2). But anyway that's pure mathematics. My next problem is more important, which is:



Herman is quite pessimistic. His probability of 1 - ln2 is correct in the limit towards infite prisoners. I guess in the finite case at hand the survival chance is exactly 1/2 - 1/3 + 1/4 ...... + 1/100 which is about 0.01 % better than Herman's value. I didn't manage to prove my formula yet. At least I checked it for n =2 and n = 4. When I was trying n = 6 to discover the system, some friends came to visit me unexpectedly, disturbing my cycles. Odysseus' descendents, Cyclops presumed.
I think I am so I think I am.
User avatar
cyclops
Lives in sente
Posts: 801
Joined: Mon May 10, 2010 3:38 pm
Rank: KGS 7 kyu forever
GD Posts: 460
Location: Amsterdam (NL)
Has thanked: 353 times
Been thanked: 107 times
Contact:

Re: Logical puzzles

Post by cyclops »

entropi wrote:
1- I still don't get how you calculate 1-ln(2). It is not at all apparent for me that the probability of the longest loop not exceeding 50 is 1-ln(2). But anyway that's pure mathematics. My next problem is more important, which is:


I'll try to calculate what is the probability that there is one cycle of length 51 exactly if we shuffle the numbers 1 to 100.
There are 100! shuffles ( permatutions ). How many contain a 51 cycle?
There are 100 over 51 that is 100! / ( 51! * 49! ) ways to divide the numbers in two groups: the 51 cycle group and the rest. The rest can be ordered at 49! different ways.
For the 51 cycle we have 50 ways to choose the first element, 49 ways for the second and so on. So from 51 numbers one can realize a 51 cycle in 50! ways.
All together, taking quotients and products, the probability is 1/51.

For Herma's problem to get the probability of failing:
You repeat this for 51-cycles to 100-cycles and add the probabilities. ( They are exclusive ). So you get:
1/51 + 1/52 + 1/53 + .. .. + 1/100 as the probability for failure.
Somehow this sum equals 1 - 1/2 + 1/3 - 1/4 .. + 1/100. And this approaches ln(2).
Because ln(1+x) = x - x^2/2 + x^3/3 - x^4/4 ... ( substitute x = 1 )
I think I am so I think I am.
User avatar
Redundant
Lives in sente
Posts: 924
Joined: Thu Apr 22, 2010 3:00 pm
Rank: lazy
GD Posts: 0
KGS: redundant/silchas
Tygem: redundant
Wbaduk: redundant
DGS: redundant
OGS: redundant
Location: Pittsburgh
Has thanked: 45 times
Been thanked: 103 times

Re: Logical puzzles

Post by Redundant »

For a derivation of the probability in the prisoner puzzle see wikipedia.
Post Reply