Grundy's Game

Grundy's game is a two-player impartial game. The game starts with a single pile of n stones. A move chooses one pile with at least three stones and splits it into two non-empty piles of different sizes. A player who cannot make a move loses, and both players move optimally.

A pile of size 1 or 2 is terminal because it cannot be split into two non-empty piles of different sizes. Two piles of equal size are never a legal product of one move, so 4 cannot become 2 + 2, while 3 can become 1 + 2.

The game is a disjoint sum of independent piles, so the Sprague-Grundy theorem applies. Define g(k) as the Grundy number of a single pile of size k:

g(k) = mex{ g(i) XOR g(k - i) : 1 <= i < k - i }

with g(1) = g(2) = 0. The first player wins from a single pile of size n exactly when g(n) != 0.

The initial values are g(1..10) = 0, 0, 1, 0, 2, 1, 0, 2, 1, 0. The losing sizes are 1, 2, 4, 7, 10, 20, 23, 26, 50, 53, 270, ..., which is not the Fibonacci sequence. In particular 3, 5, 8, 13, 21 are all winning sizes.

Examples
Input: 6
Output: true
Hints

Grundy's Game

Grundy's game is a two-player impartial game. The game starts with a single pile of `n` stones. A move chooses one pile with at least three stones and splits it into two non-empty piles of different sizes. A player who cannot make a move loses, and both players move optimally.