I was reading about variations of the nim game where 2 players remove matches from a pile of matchsticks.
In this variation players can remove $1,3$ or $4$ matches.
I can see that the player wins if the number of matches in the pile is:
{1, 3, 4, 5, 6, 8, 10, 11, 12, 13, 15, 17 ....}
and the player loses if the number of matches in the pile is:
{0, 2, 7, 9, 14, 16 ...}
It is not clear to me what is the pattern that indicates if the number of matches is a win.
I thought 4*2 = 8 (win) but also 4*2 + 1 = 9 (lose) so some multiple of the number of matches to remove is not a winning state.
What is the pattern here?
For the set $\{1,2,3,4,5,6,7\}$ the losers are $\{2,7\}.$
Inductively assume that for $\{1,2,3, \cdots, (7n-2), (7n-1), 7n\}$ the losers are precisely those numbers that are congruent to either 2 or 7, mod 7.
Consider the numbers $\{(7n+1), (7n+2), \cdots, (7n + 7)\}.$
(7n+1) can take 1, leaving (7n), so (7n+1) is a winner.
(7n+2) must leave (7n+1), (7n-1), (7n-2), which are all inductively assumed to be winners. Therefore, (7n+2) is a loser.
By very similar reasoning, (7n+3) through (7n+6) are winners and (7n+7) is a loser.