[ISSUE] Pick Stone

本文通过数学归纳法探讨了在特定数量的石头堆中,如何通过策略确保优先取石者赢得游戏。文章深入分析了斐波那契数列与游戏胜负之间的关系,并提供了解决此类问题的思路。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Describe

Two players would like to pick up some from one heap of stones. Assume the quantity of stones is 100 and these two men pick up some one by one. The winner is whom brings the last one.

Please figure out the solution that the prior picker wins the game.

Rule

  1. No one can pick up all the stones once if he is the prior picker;

  2. The number of stones player can pick up must not exceed the double of previous one pick after the first pick.

Resolve

There exits one assumption:

  • If the quantity of stones is a Fibonacci number (in Fibonacci sequence), the first picker will lose this game.

Give a proof using mathematical induction:


Let F(i) denotes the number of stones, x is the number the first player picks up and y is the number the second player does.

  1. When i=2, it’s easy to comprehend that assumption meets the 1st rules.

  2. Assume when i<=k, that assumption is true.

When i=k+1, F(k+1)=F(k)+F(k-1).

The terms F(k) and F(k-1) are Fibonacci numbers and both let the first picker lose.

It’s obvious to see that the first picker would lose when x>F(k+1)/3. Then if x<=F(k+1)/3, we will get x<F(k-1)<F(k). Because of this:

F(k-2)<F(k-1) => F(k-1)+F(k-2)<2*F(k-1) => F(k-1)+F(k)<3*F(k-1) => F(k+1)/3<F(k-1)<F(k)

So when x<F(k-1)<F(k), y can be F(k-1)-x and let the number of stones become a Fibonacci number F(k). This proves the first picker must lose again.

Above all, first picker is loser when stones number is a Fibonacci number.


Let’s explore another situation, that is stones quantity is not a Fibonacci number (like the issue condition: 100).

Before we expand the discussion of this situation, let’s see Zeckendorf representation.

  • Each positive integer could be denoted as the cumulation of several discontinuous Fibonacci numbers (in Fibonacci sequence).

We can get that F(k)>2*F(k-2) because of F(k-1)+F(k-2)>2*F(k-2). This can be more general that F(k)>2*F(k-i) with i>=2.

The first picker will win if he pick up the minimal Fibonacci number as a part of the stones number. After this, the second player will become the first picker of the second minimal Fibonacci number so that the first picker has an opportunity to become the last-one picker, according to the previous prove.

This progress will be more clear if we use the one number to explain. Here is the answer of the issue.

Answer

According to Zeckendorf representation, 100 stones can be represented by 100=89+8+3.

Let x and y be the number of stones the first and second player picks up in one round.

Here is one example:

Round 1: x=3, y=6; left=91;
Round 2: x=2,|y=4; left=85;
Round 3: x=4, y=8; left=73;
Round 4: x=13, y=26; left=34;
Round 5: x=34. (win)

 

源引自己的github.io

http://awarrior.github.io/pick-stone/

 

转载于:https://www.cnblogs.com/awarrior/p/4377537.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值