Given $n$ stacks of cards, stack $i$ contains $a_i$ cards ($1\le i\le n$) such that each $a_i$ is odd. Two players $A$ and $B$ play a game. Players alternate turns. In a move, a player takes an arbitrary stack and splits it into $3$ new non-empty stacks, such that each of the new stacks still contain odd number of cards. The player who cannot make a move loses. If $A$ goes first, is there any condition on the $a_i$'s to determine who has a winning strategy? It is assumed that both players play optimally.
Thanks for any help.
Each $a_i$ takes exactly $\frac {a_i-1} 2$ moves to get down to all ones - easily shown by induction. $A$ wins iff the total number of moves in the game is odd $\Leftrightarrow \sum_{i=1}^n(a_i-1)=2 \mod 4$