Solution:
At each stage of the game, let S be the sum of one less than each pile height. For example, if the piles are 8,6,2,2,1, then S=7+5+1+1+0. Observe that S is also equal to the total number of pennies minus the number of piles, and thus, S always decreases by 1 each turn. We shall analyze the parity of S.
The only way a player will win is if on their turn, one pile has 3 or 4 pennies, with the other piles (if there are any) of height 2 or 1. We call such a position "penultimate." For example, 4, 2, 2, 2, 1 is penultimate (and the winning move will split the 4 into two piles).
If a position is not penultimate, but can be turned into a penultimate position in one move, we call it "antepenultimate." For example, 4, 3, 2, 2, 2, 1 is antepenultimate (if the 4 is split). Notice that an antepenultimate position doesn't always have to become a penultimate position in one move. For example, with the position above, instead of splitting the 4, we could split one of the 2-piles.
The antepenultimate positions fall into 2 cases:
- A 5 or 6, and the rest (if any) are 2's and 1's.
- Two piles that are 3 or 4, and the rest (if any) are 2's and 1's.
We make two observations:
- The number of 1's are irrelevant (since they cannot be changed, and also they do not alter the value of S).
- Without loss of generality, the number of 2's in a pile (if there are any) is either 1 or 2. If a position had more than two 2's, they can be removed and it would not change the parity of S, nor would it affect who wins the game (since the only thing that can be done with a 2-pile is either to leave it alone or split it into two 1-piles).
Thus there are only a few cases to check, and in all of them, we discover that:
If a position is antepenultimate and S is odd, then the player who has this position will win. If a position is antepenultimate and S is even, then the player who has this position will lose.
For example, 5, 2, 1 is antepenultimate and S=5. The player splits the 2, and then her opponent has no choice but to split the 5, handing the penultimate position to the first player, who wins.
Now we can use this analysis to look at what happens from the very start of the game.
- If n=3 or n=4, the first player already has a penultimate position and wins.
- If n=5, then the starting position is antepenultimate and S is even. Clearly the second player wins.
- If n=6, then the starting position is antepenultimate and S is odd. Clearly the first player wins.
- If n>7, then the starting position is not antepenultimate. If S is odd to start, it will always be odd when it is player 1's turn (since S drops by 1 each time). So at some point, player 1 will either get the penultimate position and will win, or will get the antepenultimate position with odd S, and will win. By similar reasoning, if n is odd, S starts out even, and player 1 will lose.