0

For the first 20 positive integers, the recursive digit sum (mod 9) of their squares follow a pattern of repeating 1, 4, 9, 7, 7, 9, 4, 1, 9. I wonder whether this pattern applies to all integer numbers. If it does, what will be the reason behind this phenomenon? Any suggestions?

Some examples below:

1, 1, 1
2, 4, 4
3, 9, 9
4, 16, 7
5, 25, 7
...
9, 81, 9
10, 100, 1
11, 121, 4
...
19, 361, 1
  • What's a recursive digit sum? Do you just mean "iterate until you get a single digit"? If so, you are just picking up $n^2\pmod 9$ (where, of course, you must represent $0$ by $9$). Should say: I don't understand your "examples". – lulu Oct 01 '22 at 12:06
  • Yes, you are right. For example, for 19, its square is 361 and its recursive digit sum (mod 9) is 3 + 6 + 1 => 1 + 0 (10) => 1. – Devs love ZenUML Oct 01 '22 at 12:10
  • In general, the iterated digit sum of $n$ is always just $n\pmod 9$, with the substitution I mentioned. Nothing special about squares. – lulu Oct 01 '22 at 12:12
  • Maybe I do not understand your comment correctly or I did not explain my question clearly enough. My questions is around the repeating of 1, 4, 9, 7, 7, 9, 4, 1, 9 as sequential numbers. So given "1 to N", the result keeps repeating 1, 4, 9, 7, 7, 9, 4, 1, 9? (This is actually asked for my son who found this phenomenon :D) – Devs love ZenUML Oct 01 '22 at 12:21
  • 1
    But of course ${n^2}\pmod 9$ is periodic. That follows from the remark $(a+9)^2\equiv a^2 \pmod 9$. The same claim would hold for $n^3, n^4, n^{171}$ and so on. The least period might be smaller than $9$, but $9$ is always a period. – lulu Oct 01 '22 at 12:23
  • Also, the fact that $(9-n)^2 \equiv (-n)^2 \equiv n^2 \pmod{9}$ explains the mirror symmetry within one period. – aschepler Oct 01 '22 at 12:38

1 Answers1

1

To summarize the discussion in the comments:

Let's denote the iterated digit sum by $S(n)$. It is well known, and easy to demonstrate, that $n\equiv S(n)\pmod 9$. Indeed, $S(n)$ is essentially equal to the remainder you get on dividing $n$ by $9$, with the proviso that if the remainder is $0$, $S(n)=9$.

Now, consider the sequence $\mathscr S=\{S(n^2)\}$. Since $(n+9)^2\equiv n^2\pmod 9$ we see that $\mathscr S$ is periodic with period $9$. A priori there might be a period smaller than $9$ but in this case there is not.

The same argument would apply to any power, not just squares. For instance the sequence of the digit sum of cubes is $\{1,8,9,1,8,9,\cdots\}$ which has period $3$ (note that $3$ divides $9$ so $9$ is still a period, just not the least one). Or you could take fifth powers to get the periodic sequence $$\{\overline {1,5,9,7,2,9,4,8,9}\}$$

and so on.

lulu
  • 70,402