# recursive digit sum of cubes of integers.

For every cube of an integer, the recursive sum of its digits , e.g. 729 -> 18 -> 9 etc. is always 1,8 or 9. With a computer program i checked this phenomenon up to 1000000000. In my prior question(link-> A mathematical phenomenon regarding perfect squares....) i asked the mathematical reason behind similar phenomenon regarding perfect squares. Now i wonder what will be the reason behind this cube phenomenon? Any answer? Some of the last outputs of cubes and their recursive sum of my program are below:

970299000 Recursive sum is 9

973242271 Recursive sum is 1

976191488 Recursive sum is 8

979146657 Recursive sum is 9

982107784 Recursive sum is 1

985074875 Recursive sum is 8

988047936 Recursive sum is 9

991026973 Recursive sum is 1

994011992 Recursive sum is 8

997002999 Recursive sum is 9

If we go further.... For every 4th power of an integer the recursive sum of digits is either 1,7,9 or 4. For every 5th power of an integer the recursive sum of digits is either 1,2,4,5,7,8 or 9. Can we derive some formula that can tell the recursive sum of digits of n'th power of an integer?

-
I anticipate you will ask this for 5th power as well, so I checked it, and the "recursive sums" $3$ and $6$ never occurs for 5th powers, because $3$ and $-3\equiv 6$ are not 5th powers modulo $9$. –  Jeppe Stig Nielsen May 19 at 10:39
Also, for 6th power(or any multiple of 6) the digit sum will be either 0 or 1. Also the sequence of digit sums will loop from 2nd power to 8th power. –  Taemyr May 19 at 10:59
Well for fifth power the recursive sum of digits is always 1,2,4,5,7,8 or 9. I checked up to 1000. Some of the last outputs of the program are here.... For 999 to the power 5th is 995009990004999 Recursive sum is 9. –  Deepeshkumar May 19 at 11:01

A positive integer is either $3k$ or $3k\pm 1$ for some integer $k$.

$(3k)^3=27k^3=9(3k^3)$ is a multiple of $9$.

$(3k\pm 1)^3=27k^3\pm 27k^2+9k\pm 1=9(3k^3\pm 3k^2+k)\pm 1$ is of the form $9l\pm 1$ for some integer $l$.

Together with the fact that a positive integral multiple of $9$ has recursive sum $9$, this proves your conjecture.

-
Proof of the last bit: A multiple of $9$ has remainder $0$ when divided by $9$. This remainder is invariant regarding digit summation, so any $k$-th digit sum must have remainder $0$ as well. In case of the single digit sum it must be $0$ or $9$ to yield remainder $0$. $0$ only happens for input $0$. So it is $9$. –  mvw May 20 at 12:57

cubes are always one of $0,1,8 \pmod 9.$

Summing digits in base ten preserves values $\pmod 9.$

-

## a) Integer Cubes modulo 9

We can decompose any non-negative integer $n$ as $$n = 9 q + r$$ for some non-negative integers $q$ and $r$ and thus get $$n^3 = (9 q + r)^3 = 9^3 q^3 + 3\cdot 9^2 r q^2 + 3 \cdot 9 r^2 q + r^3$$ where we see that its cube fullfills $$n^3 \mod 9 = r^3 \mod 9$$ Knowing that $r \in \left\{ 0, \ldots, 8 \right\}$ we calculate all remainders of $r^3$ and see that only values from $\left\{ 0, 1, 8 \right\}$ occur as remainders. (As stated by user Will Jagy)

## b) Integer modulo 9 and its Digit Sum modulo 9

Applying the modulo 9 operation to a non-negative integer $n$ in decimal representation yields \begin{align} n & \mod 9 = \\ \sum_{k = 0}^N d_k 10^k & \mod 9 = \\ \sum_{k = 0}^N d_k (9 + 1)^k & \mod 9 = \\ \sum_{k = 0}^N d_k \sum_{i=0}^k {k \choose i} 9^i 1^{k-i} & \mod 9 = \\ \sum_{k = 0}^N d_k {k \choose 0} & \mod 9 = \\ \sum_{k = 0}^N d_k &\mod 9 = \\ \mbox{ds}(n) & \mod 9 =: r \end{align}

This means the digit sum $\mbox{ds}(n)$ has the same remainder $r$ like the original value $n$, when divided by 9. The remainder is invariant regarding digit summation here. (As stated too by user Will Jagy)

## c) Monoticity of the Digit Sum

For any non-negative integer $n$ with two or more digits in decimal representation, we have $10^k > 10^0$ for $k > 0$ and thus $$n = \sum_{k=0}^N d_k 10^k > \sum_{k=0}^N d_k 10^0 = \mbox{ds}(n) \ge 0$$ Thus the digit sum of any non-negative integer with two or more digits is a smaller non-negative integer.

## d) "Recursive" Digit Sum and Digit Sum modulo 9

Multiple applications of the digit sum operation will finally result into a single digit value $d \in \left\{ 0, \ldots, 9 \right\}$.

This is implied by c), where multiple application will yield smaller and smaller integers until the property is lost, that it has two more digits.

For the cube $n^3$ taken modulo 9 we know from a) and b) that it would give a remainder from $\left\{ 0, 1, 8 \right\}$. The single digits that would produce these are from $\left\{ 0, 1, 8, 9 \right\}$. The digit sum $0$ would happen only for input $0$ which was not considered in the question, otherwise the conjecture is confirmed.

-