Bob and Alice are playing a game. They will start with an integer $n$. Alice goes first, in each turn, a player can choose an integer between 1 and 13 and that number is to be subtracted from $n$. They will repeat this process alternatively. The game ends when $n$ becomes less than 1. The person who will be the telling the last number will lose the game.
Given $n$ (initial value), how could we determine the value of $n$ after the $k$th turn of Alice (If Alice plays optimally)?
PS: For this particular puzzle, it is given $n = 1251$ and $k = 19$. However, I am interested in the general solution.
Assuming only integers $\in \{2, 3, ... 12\}$ can be chosen for subtracting, clearly having $n$ of $1$ or $2$ is a bad position. It follows that $n \in \{3, 4, ...14\}$ is good, as this allows putting your opponent in a bad position at the next turn. Then $15, 16$ are bad positions, as you end up putting your opponent in a good position. Then again $\{17, 18, ... 28\}$ are all good. And so on and so forth...
So if Alice starts with a good $n$, she would subtract the required number to keep Bob bad. If Alice starts with a bad $n$, tough luck or hope Bob slips.