Prove that the sum of digits of $(999...9)^{3}$ (cube of integer with $n$ digits $9$) is $18n$

Someone had posted a question on this site as to what would be sum of digits of $999999999999^3$ (twelve $9s$ ) equal to?

I did some computation and found the pattern that sum of digits of $9^3 = 18$, $99^3 = 36$, $999^3 = 54$ and so on. So, I had replied that sum of digits of $999999999999^3 = 12 \cdot 18 = 216$.

Can anybody help me prove this, that sum of digits of $(\underbrace{999\dots9}_{n\text{ times}})^3 = 18n.$


Solution 1:

Observe that:

$\left(\underbrace{9\dots9}_{n\text{ times}}\right)^3=(10^n-1)^3=10^{3n}-3\cdot10^{2n}+3\cdot10^{n}-1=\underbrace{9\dots9}_{n-1\text{ times}}7\underbrace{0\dots0}_{n-1\text{ times}}2\underbrace{9\dots9}_{n\text{ times}}$


Therefore, the sum of digits is $9(n-1)+7+2+9n=18n$.

Solution 2:

Well, all you have to do is to observe the pattern of the cubes themselves:

$9^3 = 729$.

$99^3=970299$

$999^3=997002999$

$9999^3=999700029999$

Now, you are in a position to make a conjecture:

Let $(k)_n$ mean the number in base $10$ represented by $k$ repeated $n$ times. Then, $((9)_n)^3 = (9)_{n-1}7(0)_{n-1}2(9)_n$.

I want you to go out and prove this conjecture yourself, use the fact that $(9)_n = 10^{n}-1$, and $(10^{n} -1 )^3 = 10^{3n} - 3\cdot 10^{2n} + 3 \cdot 10^n - 1$.

Now, use the fact that the sum of digits of $(k)_n$ is $nk$. Putting this formula above, the sum of digits of $((9)_n)^3$ is $9(n-1) + 7 + 2 + 9(n) = 18n$. Hence, for $12$ digits, your formula gives a sum of $216$, which is correct.

Solution 3:

With $n\geq 1$:

$(10^n-1)^3=10^{3n}-3\cdot 10^{2n}+3\cdot 10^n -1$ $=(10^{n-1}-1)10^{2n+1}+7\cdot 10^{2n}+2\cdot 10^n+10^n-1$.

Therefore $9(n-1)+7+2+9n=18n$.