Sum of digits of square number raised to itself

495 Views Asked by At

From testing a few different square numbers, it seems to be the case that when raising a square number to the power of itself, the sum of the digits of the result satisfy the property that the sum of their digits is the square number itself.

I realise the above sentence is quite wordy, so as an example, consider $4^4$. We know that $4^4=256$ and that $2+5+6=13$. It is also the case that $1+3=4$, i.e., the square number itself.

Is this true for any square number? And if so, how can one prove it?

2

There are 2 best solutions below

0
On BEST ANSWER

Your original claim is poorly worded in that it does not adequately distinguish between sums of digits and sums of sums of digits and what numbers should be compared against one another. As written the claim is false, as pointed out by other users, since you have the sum of digits or the sum of the sum of the digits not equaling the original number itself in some cases as is the case for example for $25^{25}$ not having sum of digits or sum of sum of digits equal to $25$.

If you were to instead talk about the repeated sum of digits for both the original number and the number to the power of itself, then we do actually have a true statement.

Claim: for perfect square $x=n^2$ one has that $x^x\equiv x\pmod{9}$

Proof by cases:

As $x=n^2$ it follows that $x$ is equivalent to one of $0,1,4,$ or $7$ modulo $9$

In the first case, we have $x^x\equiv 0^x\equiv 0\pmod{9}$ trivially.

Similarly in the second case we have $x^x\equiv 1^x\equiv 1\pmod{9}$

In the third case, $x^x\equiv 4^x\equiv 4^{9k+4}\equiv (4^{3})^{3k}\cdot 4^3\cdot 4\equiv 1^{3k}\cdot 1\cdot 4\equiv 1\pmod{9}$ noting that $4^3=64=9\cdot 7 + 1$

Finally, for the fourth case we have $x^x\equiv 7^{9k+7}\equiv (7^3)^{3k}\cdot 7^3\cdot 7\equiv 1^{3k}\cdot 1\cdot 7\equiv 7\pmod{9}$ just like in the previous case.

0
On

I wrote the following code where I interpreted that you sum up your digits twice:

def digitsum(n):
    ans = 0
    while n>0:
        r = n % 10
        ans += r
        n //= 10
    return ans

for i in range(1, 8):
    sq = i**2
    cur = sq**sq
    cur1 = cur
    cur = digitsum(cur)
    cur2 = cur
    cur = digitsum(cur)
    print(sq, cur1, cur2, cur)

and it gives me the following result:

1 1 1 1
4 256 13 4
9 387420489 45 9
16 18446744073709551616 88 16
25 88817841970012523233890533447265625 151 7
36 106387358923716524807713475752456393740167855629859291136 270 9
49 66009724686219550843768321818371771650147004059278069406814190436565131829325062449 355 13

It holds for the first $4$ squares.


If your question is

$$n^{2n^2}\equiv n^2 \pmod{9}$$

If $n$ is a multiple of $3$, both sides is evaluated to be $0$.

If $n$ is coprime with $3$, then $n-1$ or $n+1$ must be a multiple of $3$.

$$n^{2(n^2-1)}\equiv n^{2(n-1)(n+1)}\equiv 1 \pmod{9}$$

since $2(n-1)(n+1)$ is a multiple of $6=\phi(9)$.