0%

Problem 665


Problem 665


Proportionate Nim

Two players play a game with two piles of stones, alternating turns.

On each turn, the corresponding player chooses a positive integer n and does one of the following:

  • removes n stones from one pile;
  • removes n stones from both piles; or
  • removes n stones from one pile and 2n stones from the other pile.

The player who removes the last stone wins.

We denote by (n,m) the position in which the piles have n and m stones remaining. Note that (n,m) is considered to be the same position as (m,n).

Then, for example, if the position is (2,6), the next player may reach the following positions:
(0,2), (0,4), (0,5), (0,6), (1,2), (1,4), (1,5), (1,6), (2,2), (2,3), (2,4), (2,5)

A position is a losing position if the player to move next cannot force a win. For example, (1,3), (2,6), (4,5) are the first few losing positions.

Let f(M) be the sum of n+m for all losing positions (n,m) with nm and n+mM. For example, f(10)=21, by considering the losing positions (1,3), (2,6), (4,5).

You are given that f(100)=1164 and f(1000)=117002.

Find f(107).


等比例取石子游戏

两名玩家正在玩一个取石子游戏,这个游戏需要两堆石子,两名玩家交替行动。

在每一回合,轮到行动的玩家选择一个正整数n,然后进行以下操作之一:

  • 从一个堆中移除n个石子;
  • 从两个堆中各移除n个石子;
  • 从一个堆中移除n个石子,并从另一个堆中移除2n个石子。

最终,移除最后一个石子的玩家获胜。

我们用(n,m)表示两堆分别还剩n个和m个石子的状态。注意(n,m)(m,n)被视为相同的状态。

比如说,如果当前状态是(2,6),那么即将行动的玩家可以达成的状态包括:
(0,2), (0,4), (0,5), (0,6), (1,2), (1,4), (1,5), (1,6), (2,2), (2,3), (2,4), (2,5)

如果即将行动的玩家不能确保获胜,则称当前状态为必败态。例如,(1,3)(2,6)(4,5)就都是必败态。

对于所有满足nmn+mM的必败态(n,m),记它们的n+m的总和为f(M)。例如,f(10)=21,对应的所有必败态即为(1,3)(2,6)(4,5)

已知f(100)=1164f(1000)=117002

f(107)


Gitalking ...