wu :: forums (http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi)
riddles >> medium >> How Many Eggs?
(Message started by: ThudanBlunder on Sep 4th, 2007, 10:55am)

Title: How Many Eggs?
Post by ThudanBlunder on Sep 4th, 2007, 10:55am
Jill went to the market and bought some eggs. On her return Jack asked her, "How many eggs do you have?" "A prime number less than 50", she replied enigmatically. "I mean how many exactly?", he persisted. Instead of answering she produced a normal die. "We'll play a game", she said. "You roll the die first and whatever number comes up, you take that number of eggs. After that we take turns giving the die a quarter-turn to a new face, again taking that number of eggs. Whoever is first unable to take the correct number of eggs, because there are not enough left, loses." Jack said he understood, and rolled the die. "You've lost!", said Jill, who was a perfect logician. Jack suggested he should have thrown one higher or one lower. "You would still have lost", she gloated. "But by correct play you could have won if you had thrown anything else."

1) What is the minimum number of eggs remaining in the basket such that there is no winning turn of the die?
2) How many eggs did Jill buy, and what did Jack throw?


Title: Re: How Many Eggs?
Post by srn347 on Sep 4th, 2007, 5:42pm
Although I cannot answer currently, I will give a hint to fellow puzzlers. Rolling the die from side n gets it to any other side except 7-n.

Title: Re: How Many Eggs?
Post by Sameer on Sep 4th, 2007, 7:09pm
1. [hide] I don't know I quite follow this question, but wouldn't the answer be 1? Let's say on previous turn the die was showing up 6 where you removed 6 eggs from a remaining 7 eggs, then you can never remove that 1 egg. [/hide]

Or does that boil down to what are the valid combinations of eggs left due to these turns, which would give us the required minimum?

Title: Re: How Many Eggs?
Post by ThudanBlunder on Sep 4th, 2007, 7:22pm
Sameer, if there is one egg remaining then the thrower loses if 1 or 6 is thrown.
But if any other number is thrown, we turn the die to 1 and take the last egg, winning.
That is, one egg remaining is not guaranteed to lose.

Title: Re: How Many Eggs?
Post by Sameer on Sep 4th, 2007, 7:31pm
Ah so does the game go like this.. Jack throws takes eggs, Jill does a quarter turn takes eggs. Jack throws again.... etc.?

Title: Re: How Many Eggs?
Post by ThudanBlunder on Sep 4th, 2007, 7:53pm

on 09/04/07 at 19:31:40, Sameer wrote:
Ah so does the game go like this.. Jack throws takes eggs, Jill does a quarter turn takes eggs. Jack throws again.... etc.?

Sorry, I meant the die is thrown only once (by Jack).
He takes that number of eggs, then each of them then take turns turning the die and taking eggs.

So if there is one egg left, you will not lose if 2,3,4,5 is showing as you can turn it to 1 and take the last egg.  

Title: Re: How Many Eggs?
Post by Sameer on Sep 4th, 2007, 8:02pm
Oh wait!!So Jack knows the number of eggs when he is playing. These sentences confuse me!!

--

"You've lost!", said Jill, who was a perfect logician. Jack suggested he should have thrown one higher or one lower. "You would still have lost", she gloated. "But by correct play you could have won if you had thrown anything else."

--

Title: Re: How Many Eggs?
Post by ThudanBlunder on Sep 5th, 2007, 4:19am

on 09/04/07 at 20:02:43, Sameer wrote:
These sentences confuse me!!
--
"You've lost!", said Jill, who was a perfect logician. Jack suggested he should have thrown one higher or one lower. "You would still have lost", she gloated. "But by correct play you could have won if you had thrown anything else." --

This means that for the amount of eggs she had, three consecutive numbers, (1,2,3), (2,3,4), (3,4,5), or (4,5,6), are all losing throws with best play by the other player, Jill. And that any other number would have won with best play by the thrower, Jack. But we don't know which of those four sets applies.


Title: Re: How Many Eggs?
Post by Grimbal on Sep 5th, 2007, 6:26am
Is it Jill who plays after Jack made his random move?

for 1) [hide] I get 9 eggs [/hide]
For 2) [hide] I find there is no answer.  But I find that 43 answers the reverse questions, namely that with 3 successive throws he can win, but all others he looses. [/hide]

Title: Re: How Many Eggs?
Post by ThudanBlunder on Sep 5th, 2007, 1:38pm

on 09/05/07 at 06:26:30, Grimbal wrote:
Is it Jill who plays after Jack made his random move?

Affirmative.

How did you get your answers; a computer program or by compiling a table or some other method?

Title: Re: How Many Eggs?
Post by srn347 on Sep 5th, 2007, 11:04pm
Was that with help from my hint?

Title: Re: How Many Eggs?
Post by ThudanBlunder on Sep 6th, 2007, 2:11am

on 09/05/07 at 23:04:48, srn347 wrote:
Was that with help from my hint?

If you actually believe it possible that Grimbal did not know that opposite faces of a die sum to 7 then you are not nearly as smart as you think you are.

Title: Re: How Many Eggs?
Post by Grimbal on Sep 6th, 2007, 12:30pm
Well you could say that in a more gentle tone.

It can happen that I need a hint.  In this case, I didn't need it.

I figured that from a face, you roll to any face except n and 7-n.  This makes opposites faces equivalent as to where you can roll from there.

How did I solve it?
[hide]I made a spreadsheet.  I made a chart of all positions in terms of the number of eggs and the last die number.  I worked from the end which are the winning positions.  Zero eggs is a loosing position.  One egg is a winning position unless the die shows 1 or 6.  2 eggs is always winning because whatever the die shows, you can always turn to 1 or 2.  In both cases you leave a loosing position to your opponent.  Etc.
What I find is that for some prime number, there are three consecutive die values that get to a loosing position.  But since Jill is next to play, it is a loosing position for Jill.
Either there is a confusion in the riddle, or I missed something.  Maybe indeed part of the riddle is to figure how the die is made...[/hide]

Title: Re: How Many Eggs?
Post by ThudanBlunder on Sep 6th, 2007, 2:45pm

on 09/06/07 at 12:30:58, Grimbal wrote:
Well you could say that in a more gentle tone.

Gentle tones are wasted on srn347. He is not listening.

Title: Re: How Many Eggs?
Post by mikedagr8 on Sep 6th, 2007, 2:47pm

on 09/06/07 at 14:45:08, ThudanBlunder wrote:
Gentle tones are wasted on srn347. He is not listening.


Yes maybe a little ooomph (effort) should be used to do something about this problem of srn347.

Title: Re: How Many Eggs?
Post by Eigenray on Sep 6th, 2007, 3:07pm
I used the following table:
[hide]
d\n:0123456789...
1,6:11000000010000000010...
2,5:10000100010000100010...
3,4:10011000110011000110...[/hide]

Where an 1/0 denotes a loss/win if there are n eggs left and a d is showing on your turn.  For a given n, [hide]the set of positions S(n)={(d,n-d)} forms a V shape.  For each row, column n has a 0 iff there is a 1 at some position in S(n) on a different row.  Since the n-th column only depends on the 6 previous columns, once we get to n=17, we know the table repeats with period 9.[/hide]  For each n, to find the loss/win pattern for the person starting the game with n eggs, based on the result of their first throw, we read off the values on S(n), but negated:

[hide]
01:011111
02:001111
03:110111
04:111011
05:111101
06:110110
07:100010
08:111011
09:111111
10:011101
11:100111
12:110011
13:111011
14:111101
15:110110
16:100011
17:111011[/hide],
becoming periodic at this point.  So I agree with Grimbal that the question is backwards, unless 1 is considered 1 higher than 6.

It seems the hide tag can't be used with either pre or code.  Is there a way to get hidden fixed-width font?

Title: Re: How Many Eggs?
Post by ThudanBlunder on Sep 7th, 2007, 2:00pm
Well done, Eigenray!. You too, Grimbal. I was considering putting this in Hard but you have both made it look relatively easy.

As for who turns first, without looking too closely I assumed it was Jill. But whoever it is loses. Hence it must be Jack, as you have both pointed out.

See attachment, which shows the winning move(s) for each combination of current total (of eggs remaining) and face of the die.



Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board