TITLE: A puzzle involving $10$-adic numbers
QUESTION [12 upvotes]: If one iterates the squaring: $$5^2 = 25, 25^2 = 625, 625^2 = 390625 $$
one quickly notices that the end digits become 'stable', i.e. however far you take the above procedure, the result will always end in $...90625.$ The resulting 'limit' is a so-called $10$-adic number.
What's also interesting is that the following procedure also leads to a stable 'limit': $$2^5 = 32, 32^5 = 33554432\dots$$ and if one multiplies the resulting $10$-adics, one gets $0$.
After similar experiments, it seems that iterating $p^q$ and $q^p$ modulo $pq$ leads to pq-adic inverses $pq$-adic numbers with product 0. How can this be shown? It feels  like this should follow easily from something like Fermat's little theorem or the CRT but I can't immediately see how to prove this.

REPLY [8 votes]: This is fun stuff. Let me try to contribute something without getting egg on my face.
The fact is, that if you write $\Bbb Z_{10}$ for the ten-adic numbers, then $\Bbb Z_{10}\cong\Bbb Z_2\oplus\Bbb Z_5$. In the direct sum on the right, you have both addition and multiplication coordinatewise, i.e. for $a,a'\in\Bbb Z_2$, two-adic integers and $b,b'\in\Bbb Z_5$, five-adic integers, the two rules $(a,b)+(a',b')=(a+a',b+b')$ and $(a,b)(a',b')=(aa',bb')$.
Best way to show this is to find a pair of orthogonal idempotents in $\Bbb Z_{10}$ adding up the the multiplicative identity of the direct sum. More precisely, you want $e_2,e_5\in\Bbb Z_{10}$ satisfying $e_i^2=e_i$ for $i=2,5$ and also $e_2+e5=1$, $e_2e_5=0$. And then you show that $e_2\Bbb Z_{10}\cong\Bbb Z_2$, $e_5\Bbb Z_{10}\cong\Bbb Z_5$, and the isomorphism is $z\mapsto(e_2z,e_5z)$.
You can get successive approximations to $e_2$ by using Chinese Remainder to find solutions to $e_{2,n}\equiv1\pmod{2^n}$, $e_{2,n}\equiv0\pmod{5^n}$. Then automatically, the corresponding $e_{5,n}$ will be $10^n+1-e_{2,n}$.
To four ten-adic places, these seem to be $e_2=\dots625$, $e_5=\dots9376$.
Now: how does this relate to what you found? There’s a theorem for the $p$-adic numbers that if $v_p(z-1)=m$, then $v_p(z^p-1)=m+1$. Here, $v_p(z)=k$ means that $p^k$ is the highest power of $p$ dividing $z$. That is, taking the $p$-th power of something ($p$-adically) close to $1$ gets you closer, but by only one step. You started with $5$, which has $v_2(5-1)=2$, and squared, to get $v_2(25-1)=3$. Squaring $25$, you got $v_5(625-1)=4$. For $z=2$, you recognized that you needed to take successive $5$-th powers. But you started with something incongruent to $1$ mod $5$, so the Theorem didn’t quite apply. If you had started with $16$ instead, then $v_5(16-1)=1$, $v_5(16^5-1)=v_5(1048576-1)=2$, etc. As I said in my comment above, this is not as it stands an efficient way of getting successive approximations to $e_2$ and $e_5$.
The way to make the above process more efficient is to throw away digits too far to the left. Working with successive squaring of $5$, once you square $625$, square it and throw away everything to the left of the $9$: $90625^2=\dots890625$. Square $890625$ and again throw away some, getting $\dots2890625$, etc. You’re not putting excess strain on your calculator (or your eyes), and you give up when you get to $e_2=\dots259918212890625$. Now just take the nines complement of that and add two to get $\dots740081787109376$ for your $e_5$. Of course these are complementary, i.e. add to $1$ modulo the proper power of $10$, and you might want to check that this approximation to $e_5\equiv e_5^2$ modulo that power of $10$ too, and that $e_2e_5\equiv0$. I did, and they’re all right.