I had come across a problem, where 2 people play a game where think of a number n, and turn by turn subtract a number $p$ from $n$ where $p$ is a prime and is $p < n$ and 1 is taken as prime here. Now tell the person that wins for a given $n$. It can be seen by making cases that for any $n$ that satisfies the condition , $n\equiv 1 \pmod{4} $ the first player that subtracts will lose and for all other $n$ the first player wins where both players will play optimally.The losing postion is when the current player cannot subtract any p from n.
The player that has no $p$ to subtract loses.
I just want a mathematical explanation or proof for this result of possible.