The game ends when only heaps of size two and smaller remain, none of which can be split unequally.
In each of these cases, player 1 can ensure that on the next move he hands back to his opponent a heap of size 4 plus heaps of size 2 and smaller: Now player 2 has to split the 4-heap into 3 + 1, and player 1 subsequently splits the 3-heap into 2 + 1: The game can be analysed using the Sprague–Grundy theorem.
This mapping is captured in the On-Line Encyclopedia of Integer Sequences as OEIS: A002188: Using this mapping, the strategy for playing the game Nim can also be used for Grundy's game.
Whether the sequence of nim-values of Grundy's game ever becomes periodic is an unsolved problem.
Elwyn Berlekamp, John Horton Conway and Richard Guy have conjectured[1] that the sequence does become periodic eventually, but despite the calculation of the first 235 values by Achim Flammenkamp, the question has not been resolved.