# Sums of digits of Perfect Squares

1. Apr 10, 2004

### tommy05

A little while ago I noticed a pattern in the sums of the digits of perfect squares that seems to suggest that:

For a natural number N, the digits of N^2 add up to either 1, 4, 7, or 9.

ex: 5^2 = 25, 2+5 = 7

In some cases, the summation must be iterated several times:

ex: 7^2 = 49, 4+9=13, 1+3 = 4
ex: 10^2 = 100, 1+0+0 = 1

If you make a list of the summations of the perfect square digits, the following patterns emerge:

Sums of digits (of the following numbers ^ 2) -
1 > 1, 8, 10, 17, 19...
4 > 2, 7, 11, 16, 20...
7 > 4, 5, 13, 14, 22, 23...
9 > 3, 6, 9, 12, 15...

(As an extension, this pattern seems to hold up for N ^ any even power...this might help in formulating a proof. )

Does anyone know if there exists a proof for this apparent pattern, or does anyone have any idea of how to formulate a proof for it?

2. Apr 10, 2004

### matt grime

as any even power is also a square, that part is implied by the first.

as for the first, well, i can prove it for about 1/3 of the natural numbers (those divisible by three)

i've got half an idea as to how to show the rest of it but it's late on the weekend right now...

3. Apr 11, 2004

### honestrosewater

Just a first thought...

Now I'm interested, so I will work on it later, but just for starters, I would sum the digits of each N first, and see what that pattern revealed...
i.e.
one digit #'s sums, 1-9: 1,2,3,4,5,6,7,8,9,
the teens, 10-19:1,2,3,4,5,6,7,8,9,1,
20-29: 2,3,4,5,6,7,8,9,1,2,

99999: 9*5=45, 4+5=9
100000: =1

actually I could have laid that out much better, but you get the idea, 1-9 repeats.

Well, must run, happy thoughts

Rachel

4. Apr 11, 2004

### honestrosewater

Oh yeah

And, it the sums work for N= 1-9

5. Apr 11, 2004

### honestrosewater

If someone can do this faster than I am...

Break down your multiplication and/or addition algorithm and analyze, track each step.
If anyone is even there or cares
Okay, I'll stop

Rachel

6. Apr 11, 2004

### honestrosewater

Sorry, but quickly...

Summing each N first-
cubes have sums: 1, 8, 9 repeating in order
^5: 1, 5, 9, 7, 2, 9, 4, 8, 9
which seems to break down, but this makes me think of Abel's proof about quintic equations...
anyway, this is the last such hasty post, I promise.

Rachel

7. Apr 11, 2004

### honestrosewater

Well, this is not AS hasty...

Noticing that N^2 is the partial sum at N (that is at the nth term, starting at 1) of the constant sequence N,
<enclose subscripts>
i.e. 4^2 = 4<1> + 4<2> + 4<3> + 4<4>
and recalling how the sums of each N repeat: 1, 2, 3, ... 9, 1, 2, ...
you just show how the sum at 4444 is equal to the sum of the digits of the square... sorry for my poor explanation. I will seriously stop this time and complete my thoughts before posting again.

Rachel

8. Apr 11, 2004

### honestrosewater

Last words :)

If someone is familiar with modulo computations, as I am not, it should just be a matter of finding the values of: 1, 22, 333, 4444, 55555, etc. modulo 9, or however you say it.
Not sure if this will suffice as a proof, but I really have to run this time- so much fun, though :) I will certainly check back later! You may have to go the sequence route for rigour...

Rachel

9. Apr 11, 2004

### tommy05

Well, all of the multiples of 3 can be eliminated (as mentioned above) by noting that any multiple of 3 raised to an even power is a multiple of 9:

(3Q)^N = 3^N * Q^N = 9^(N/2) * Q^N, and since N is even, N/2 must be an integer.

The digits of any multiple of 9, then, add up to 9.

Another way of analyzing this, which I'm going to look at when I have more time, is resolving the base Q into its prime factors, and try to see how that influences the sum of the digits of Q^2. Obviously, when 3 is a factor of Q, the sum is 9...

I'll keep looking into this :)

10. Apr 11, 2004

### matt grime

Rachel, it is very unclear what you are doing. Please take more time to explain.

11. Apr 11, 2004

### matt grime

Actually it does come out quite easily, I'm ashamed I didn't see it immediately.

Suppose k=k_nk_{n-1}....k_0 is the writing of k in base ten expansion. ie k = sum k_i10^i, as i runs from 0 to n. Let S be the sum of the digits of k, then S==k mod(9)

further if k is a perfect square this implies S is a quadratic residue mod(9), that is S is one of 1,4,7,9. Moreover we see that k=1,4,9,16 show that all of these possibilities must occur.

12. Apr 11, 2004

### honestrosewater

Cheers :)

Matt,
Well, that was greek to me, but I'm glad you know what you mean, err... something...
And, yes, I apologize for the public brainstorm, emphasis on Storm- I'm an independent student and rarely ever get to play with others ;) That and too much coffee.
I was just now trying to clean up my argument, and it looks like if you define, for a and b in N, a^b as the partial sum of the first a^(b-1) terms of the series whose every term is a, (oh precious symbols, I miss them ;) then you can extend the argument to all b. I haven't written this out yet to check it, but the reasoning seems sound. (famous last words, right hehehe...) The modular sequence, whatever it's properly called, certainly doesn't change. Only the number of terms of a to be summed, and thus the values for which you need to prove congruence. And this should follow a general rule. (?I think!)
Happy thoughts
Rachel

13. Apr 11, 2004

### matt grime

14. Apr 11, 2004

### honestrosewater

If your aim is only to sum the digits of a number, or several numbers, then their place value (ones, tens, millions) is irrelevant, yes? Since you define place value as the product of the digit and the appropriate power of ten, which is just the digit followed by zeros.
abcd = a*10^3 + b*10^2 + c*10^1 + d*10^0

(1, 10, 100, ...) = 10^(r-1) with r_1 = 1. <S>

Then, to find the sum of the digits of a^b,
Multiply [the partial sum of <S> at a^(b-1)] by a.
Now locate this value in your modal sequence and... presto! (?I think!)

Let me know if this helps, as I have so much reading to do, I won't be able to study modal arithmetic any time soon.

BTW, the expansion of the products of the partial sum times a looks interesting... I think it might rob me of some sleep tonight ;)

Happy thoughts
Rachel

15. Apr 11, 2004

### matt grime

You see this line:

(1, 10, 100, ...) = 10^(r-1) with r_1 = 1. <S>"

and this line

"Then, to find the sum of the digits of a^b,
Multiply [the partial sum of <S> at a^(b-1)] by a.
Now locate this value in your modal sequence and... presto! (?I think!)"

now there's absolutely no link between them as far as I can see.

not least because, for some reason, you want to examine 4444, and the sum there is, er, 12, ie 3, which contradicts the proof of the observation offered. Although what modal sequence is, or its value is a little hazy

Last edited: Apr 11, 2004
16. Apr 11, 2004

### tommy05

Matt, would it be too much to ask you to expand your modular arithmetic operation or explain it so someone who isn't too familiar with modular arithmetic can understand it? I'm only in first-year calculus right now, so I haven't been exposed to modular arithmetic and residues...(perhaps I'll read up on that along with all the books on my list for the Zeta Function!)

thanks :)

Last edited: Apr 11, 2004
17. Apr 11, 2004

### matt grime

Write n^2 as $$\sum_{i=0}^{n}k_i10^i$$ then the sum of digits of n^2 has remainder on divisios by 9 the same as the sum of k_i does. But this sum must be a "qaudratic residue", meaning it is, well congruent to a square after division by 9, and the only such residues are 1,2,4,9. I don't know that I can explain it more clearly than that in this forum. Look it up on the web somewhere (legendre symbols, quadratic maths adn so forth)

18. Apr 11, 2004

### honestrosewater

To clarify

Matt,

I'll try again, and try not to just repeat what I said earlier. It may be that my reasoning is faulty, as I certainly haven't done a thorough analysis. That said, I don't think this is complete garbage.

Consider N^2 and N^2m, that is, all even powers as a special case of a more general rule which applies to all powers p in N.

The sum of the digits of all perfect cubes equals either 1, 8, or 9.
1
8
2+7 = 9
6+4 = 1 + 0 = 1
1+2+5 = 8
2+1+6 = 9
etc.
Which suggests a pattern similar to the squares.
However, the first nine sums of the fifth power do not themselves suggest any pattern, at least not to me.

BUT their pattern will still repeat every 9 numbers because the sums of the digits of each n in N repeats every 9 numbers.

I have computed the first 20 values for n^5:
1 =1
32 =5
243 =9
1024 =7
3125 =2
7776 =9
16807 =4
32768 =8
59049 =9
100000 =1
161051 =5
248832 =9
371293 =7
537824 =2
759375 =9
1048576 =4
1419857 =8
1889568 =9
2476099 =1
3200000 =5

I'll stop there and see if you follow.

Rachel

19. Apr 11, 2004

### matt grime

Oh, I see what you're getting at, but as a general proof has been offered (and it is correct) I think you ought to look at it and try and understand it.

The sums of the digits of the p#th power of some integer are p'th roots mod (9), that's all.

20. Apr 11, 2004

### honestrosewater

Matt,

Sorry, I wasn't attempting to give a complete proof (I am coming up with this rather on the fly). I was just trying to give you the most important results.

There is a proof of what I outlined in my last post already, you mean?

Do they use this to find the sum of the digits of any natural a^b? Because that is what I think I can do.

Rachel