on a variant of Nim Here is a variant of Nim:
The game is played with an odd number of tokens.
Players A and B can take 1, 2 or 3 tokens as usual.
When all tokens are distributed, the player with an odd number of tokens loses (I assume a misere rule would not change the study of the variant).
Could someone tell me if this is a known variant? Studied somewhere? Thanks in advance!
 A: I don't know if it is called anything in particular, but it seems simple enough to analyze.
At any point in time, it is not relevant exactly how many tokens each player has, only whether the number is odd or even.  So a position is fully described by the combination of


*

*how many tokens there are left in the pile

*whether the player whose turn it is needs to get an odd or an even number of additional token to win eventually


This means we can do a simple backwards analysis to find out whether a position is winning or losing. If we know the outcome of all positions with smaller piles than the one we're looking at, it is easy to see if we have a winning move or not.
In fact, to select a move (and know whether it wins) in a position with an $n$-token pile, it is enough to know the outcome of positions with $n-1$, $n-2$, or $n-3$ tokens in the pile. So at any time during the analysis there are only 6 future outcomes we need to remember. The analysis is different based on whether the pile is odd or even (we need this information in order to predict which parity the opponent ends up in after our turn), but still this means that there are at most $2^{2\cdot 3}\cdot 2 = 128$ states the backwards analysis can be in after we have analyzed a given pile size.
So eventually the analysis will reach a cycle, and then we can write a strategy for optimal play down as a table.
This is small enough that it could probably be done with pencil and paper in not too long a time.

Edit: I just did the pencil-and-paper analysis, and a cycle was reached when the pile size was $11. It turns out that a position is losing iff


*

*You need to take an even number of tokens, and there are $8n+1$ or $8n+4$ tokens in the pile, or

*You need to take an odd number of tokens, and there are $8n$ or $8n+5$ tokens in the pile.


Otherwise you have a winning move.
