$A$ and $B$ play the following game. Initially, for positive integer $n$, each player takes turns choosing one of three numbers:
$1$
the number of digits of $n$
the sum of the digits of $n$.
and then updates the number $n$ by subtracting the number selected. If $n$ becomes $0$, the person who has that turn wins. Who will be the winner if $A$ is always the first to go?
For example:
With $n=3$, the result is $A$, because $A$ chooses the number that is the sum of the digits of $n = 3$, after selecting, $n$ is updated and becomes $0$. So $A$ wins.
With $n=10$, the result is $B$, because $A$ can only choose $1$ or $2$ (because the number of digits of $10$ is $2$ and the sum of the digits of $10$ is $1$). So, when choosing, $n$ can only be $8$ or $9$. Next $B$ selects $8$ or $9$ and wins.
My problem is to determine who the winner is when $n$ is known.