Zero Two Seven Nine

Two players alternate. A pile holds nn stones; a move removes exactly 1, 3, or 4 stones. Whoever cannot move loses. You cannot see a pattern, so you brute force the first ten values, marking W if the player to move wins:

nn 0 1 2 3 4 5 6 7 8 9
result L W L W W W W L W L

The problem asks about n=100n = 100. What do you take from the table?

A

Ten values is not enough to justify any rule; the honest move is to extend the brute force to n=100n = 100 and read the answer off directly.

B

The losing positions are exactly n≡0n \equiv 0 or 2(mod7)2 \pmod 7. Since 100=14⋅7+2100 = 14 \cdot 7 + 2, the player to move at n=100n = 100 loses.

C

The losing positions are exactly n≡0n \equiv 0 or 2(mod7)2 \pmod 7, and 100 mod 7=3100 \bmod 7 = 3, so the player to move wins.

D

The losing positions are the even numbers below 3 and then every odd number from 7 on, which is too irregular to extend; compute n=100n = 100 with a O(n)O(n) dynamic program instead.