Solution:
For a,b∈N let us define L{a,b}={ax+by∣x,y∈N0}. We shall first prove an auxiliary claim.
Lemma. Let a>1 and b>1 be coprime natural numbers.
(a) N=ab−a−b is the largest natural number not in the set L{a,b}.
(б) For every z∈Z, z∈L{a,b} if and only if N−z∈/L{a,b}.
Proof. (a) If N=(b−1)a−b=ax+by for some x∈{0,…,b−1} and y∈Z, then x≡b−1(modb), so x⩾b−1 and hence y<0; therefore, N∈/L{a,b}.
(б) It is clear that z∈L{a,b} implies N−z∈/L{a,b} (otherwise it would hold that N=z+(N−z)∈L{a,b}). Let us now consider some z∈Z∖L{a,b}. If x∈{0,…,b−1} is such that ax≡z(modb), then z<ax, i.e., ax−by=z for some y∈N. Then N−x=(b−1−x)a+b(y−1)∈L{a,b}.
Let player A start the game by writing down a prime number a⩾5, after which player B writes down a natural number b such that a∤b. Only finitely many natural numbers do not belong to the set L{a,b}, so the game is finite. Therefore, one of the players has a winning strategy.
Let us consider the game in which player A's second move is the number N. If that is a losing move, then B now has a winning response in the form of some allowed number c. However, then player A can, on the second move, instead of the number N, write down the number c, and thereafter follow the winning strategy of the other player. Indeed, by the lemma, the number N−c is not allowed, so after the move c the number N=(N−c)+c is also not allowed, so B remains precisely in the position which would be losing for A.