```

wu :: forums
(http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi)

riddles >> hard >> Coins on a table
(Message started by: Stefan Kneifel on Aug 30th, 2003, 2:10pm)

```

Title: Coins on a table
Post by Stefan Kneifel on Aug 30th, 2003, 2:10pm
There are n coins lying on a table. Mr. A and Mr. B are playing the following game:

Mr. A begins by removing an arbitrary number of coins, except that he is not allowed to remove all coins in the first move. From then on, every player removes one or more coins, but not more than twice as many as the preceding player has taken with his last move. The player who removes the last coin wins.

1.) Who will win the game, depending on n?
2.) What is the optimal strategy?

Greetings from Switzerland :)

Stefan

Title: Re: Coins on a table
Post by Icarus on Aug 30th, 2003, 2:49pm
Welcome to the Forum!

Unfortunately this puzzle, with a different story, is one of the HARD Riddles (http://www.ocf.berkeley.edu/~wwu/riddles/hard.shtml#takeTheLastChip).

It's a good puzzle, though.

Title: Re: Coins on a table
Post by visitor on Aug 30th, 2003, 5:50pm
Actually, it's not quite the same riddle. Here you're allowed to take twice as many chips as the other person. In the thread discussing the original riddle, BNC raised this variation, but no one answered him.
It looks more complicated.
Here's my guess at the winning strategy:[hide]
The starting positions that must lose grow by the Fibonacci series: If the starting number is any other number, either take off to reach the nearest Fibonacci number, or, when you can't take off that many, think of that number as 0 and consider the fibonacci series that starts at that point. Lather, rinse, repeat as necessary.[/hide]

Title: Re: Coins on a table
Post by Stefan Kneifel on Aug 30th, 2003, 10:24pm

on 08/30/03 at 14:49:41, Icarus wrote:
 Unfortunately this puzzle, with a different story, is one of the HARD Riddles (http://www.ocf.berkeley.edu/~wwu/riddles/hard.shtml#takeTheLastChip).

Hmm.... sorry... I made a search with "Fibonacci" through the posts, and as I couldn't find this riddle, I posted it :)

Besides that: Congratulations to "visitor" :D

Title: Re: Coins on a table
Post by Icarus on Aug 31st, 2003, 11:18am

on 08/30/03 at 17:50:55, visitor wrote:
 Actually, it's not quite the same riddle. Here you're allowed to take twice as many chips as the other person. In the thread discussing the original riddle, BNC raised this variation, but no one answered him.

Sorry - I missed that. With the different limit, it is a different puzzle. As is evidenced by the different solution you provided.

My apologies, Stefan! And well done, visitor.

(By the way, with all the posts you've put in (assuming they are all the work of the same person), why haven't you registered?)

Title: Re: Coins on a table
Post by Stefan Kneifel on Aug 31st, 2003, 12:33pm
For the curious:

The riddle is due to R.E.Gaskell and M.J.Whinihan and was originally published in "Fibonacci Quarterly", 1 (December 1963), pp. 9-12.

Title: Re: Coins on a table
Post by Barukh on Sep 2nd, 2003, 5:34am
I would suggest the following generalization: at every move, the player takes no more than L times as many coins as the preceding player.  ::)

So far, we know the answer for L = 1 [hide] the first player looses on powers of 2[/hide], and L = 2 [hide] the first player looses on Fibonacci numbers[/hide].

Title: Re: Coins on a table
Post by DH on Sep 2nd, 2003, 11:01am

on 09/02/03 at 05:34:07, Barukh wrote:
 I would suggest the following generalization: at every move, the player takes no more than L times as many coins as the preceding player.  ::)

I think that the losing configurations are going to get more and more complex but it's not hard to compute them using dynamic programming. I think it can be done in O(n) time and O(n) space.

Title: Re: Coins on a table
Post by visitor on Sep 2nd, 2003, 1:00pm
For L>2 the losing numbers seem to form a sort of a Fibonacci series, except for which two numbers in the series are added.
For L=3 the losing numbers are
1,2,3,4,6,8,11,15,21,29,40,55...

For L=4
1,2,3,4,5,7,9,12,15,19,24,31,40,52...

For L=5
1,2,3,4,5,6,8,10,12,15,19,24,30,38,48,60...