0%

Problem 391


Problem 391


Hopping Game

Let sk be the number of 1’s when writing the numbers from 0 to k in binary.
For example, writing 0 to 5 in binary, we have 0, 1, 10, 11, 100, 101. There are seven 1’s, so s5 = 7.
The sequence S = {sk : k ≥ 0} starts {0, 1, 2, 4, 5, 7, 9, 12, …}.

A game is played by two players. Before the game starts, a number n is chosen. A counter c starts at 0. At each turn, the player chooses a number from 1 to n (inclusive) and increases c by that number. The resulting value of c must be a member of S. If there are no more valid moves, the player loses.

For example:
Let n = 5. c starts at 0.
Player 1 chooses 4, so c becomes 0 + 4 = 4.
Player 2 chooses 5, so c becomes 4 + 5 = 9.
Player 1 chooses 3, so c becomes 9 + 3 = 12.
etc.
Note that c must always belong to S, and each player can increase c by at most n.

Let M(n) be the highest number the first player can choose at her first turn to force a win, and M(n) = 0 if there is no such move. For example, M(2) = 2, M(7) = 1 and M(20) = 4.

Given Σ(M(n))3 = 8150 for 1 ≤ n ≤ 20.

Find Σ(M(n))3 for 1 ≤ n ≤ 1000.


跳跃游戏

写下数0至k的二进制表示,其中所有1的个数记为sk
例如,写下0至5的二进制表示,即0、1、10、11、100、101,这其中一共有7个1,因此s5 = 7。
序列S = {sk : k ≥ 0}的前几项为{0, 1, 2, 4, 5, 7, 9, 12, …}。

两名玩家正在玩一个游戏。在游戏开始前,先选定一个数n。计数器c在游戏开始时置为0。每一回合,玩家从1至n中选择一个数(包含),然后向计数器c加上这个数,其结果必须在集合S中。当不存在可行操作时,当前玩家输掉游戏。

例如:
取n = 5。c从0开始。
玩家1选择4,因此c变为0 + 4 = 4。
玩家2选择5,因此c变为4 + 5 = 9。
玩家1选择3,因此c变为9 + 3 = 12。
依此类推。
注意,c必须始终在集合S中,且每个玩家每回合最多给计数器c增加n。

记M(n)为先手玩家在保证必胜的前提下,在第一轮所能选择的最大的数;如果不存在这样的数,则M(n)=0。例如,M(2) = 2,M(7) = 1以及M(20) = 4。

已知对于1 ≤ n ≤ 20,Σ(M(n))3 = 8150。

对于1 ≤ n ≤ 1000,求Σ(M(n))3