0%

Problem 953


Problem 953


Factorisation Nim

In the classical game of Nim two players take turns removing stones from piles. A player may remove any positive number of stones from a single pile. If there are no remaining stones, the next player to move loses.

In Factorisation Nim the initial position of the game is chosen according to the prime factorisation of a given natural number $n$ by setting a pile for each prime factor, including multiplicity. For example, if $n=12=2 \times 2 \times 3$ the game starts with three piles: two piles with two stones and one pile with three stones.

It can be verified that the first player to move loses for $n=1$ and for $n=70$, assuming both players play optimally.

Let $S(N)$ be the sum of $n$ for $1 \le n \le N$ such that the first player to move loses, assuming both players play optimally. You are given $S(10) = 14$ and $S(100) = 455$.

Find $S(10^{14})$. Give your answer modulo $10^9 + 7$.


因数分解取石子游戏

在经典的取石子游戏中,两位玩家轮流从一堆石子中移除石子,每次玩家可以从一个堆中移除任意正数枚石子,首先无法移除石子的玩家输掉游戏。

在因数分解取石子游戏中,游戏的初始局面由给定自然数$n$的质因数分解决定,每个质因数(允许重复)设一个堆。例如,对于$n=12=2 \times 2 \times 3$,游戏开始时有三个堆:两个堆有两枚石子,一个堆有三枚石子。

可以验证,若两位玩家均采取最优策略,对于$n=1$或$n=70$,先手玩家必败。

记$S(N)$为所有满足$1 \le n \le N$且在两名玩家均采取最优策略时先手玩家必败的$n$之和。已知$S(10) = 14$,$S(100) = 455$。

求$S(10^{14})$,并对$10^9 + 7$取余作为你的答案。