How many $n$-digit numbers $a$ are there s.t. $a^2$ ends in $a$?
Using Chinese Remainder Theorem it is easy to calculate what these $n$-digit numbers are, $$x\equiv0\ \left(mod\ 2^n\right)\\ x\equiv1\ \left(mod\ 5^n\right),$$ and $$x\equiv1\ \left(mod\ 2^n\right)\\ x\equiv0\ \left(mod\ 5^n\right),$$ we obtain such numbers.
But my question is, how many $n$-digit numbers are there?
So far I have that there is an "upper" limit of $2n$ and a "lower" limit of $n$, but apart from that I don't know derive such a formula to calculate how many there are.
Is there a formula to show how many there are?
Thanks in advance.
Automorphic numbers must end in $0,1,5$, or $6$
As indicated by @Arnold D. here, I showed that the only automorphic numbers that end in $0$ or $1$ are $0$ and $1$.
I also showed that the automorphic numbers that end in $5$ or $6$ occur in sequences. The first $6$ are shown below
The table is meant to emphasize that the $(n+1)^{th}$ automorphic number that ends in $5$ can be found by looking at the last $n+1$ digits of the square of the $n^{th}$ automorphic number that ends in $5$.
The $n^{th}$ automorphic number that ends in $6$ is equal to $10^n+1$ minus the value of the $n^{th}$ automorphic number that ends in $5$.
Note that we must cound $0625$ as a four-digit number if we want to count $0625^2 = 390625$ as an automorphic number.
In which case, the answer to your question is $2$.