15 December 2007

Playing around with sums of squares

An interesting random fact, learned from Arcadian Functor:

12 + 22 + 32 + ... + 242 = 702

This doesn't seem quite so weird if you recall that the sum of the first n squares is n(n+1)(2n+1)/6; then the sum of the first 24 squares is (24)(25)(49)/6.

But are there any other n for which the sum of the first n squares is also a square? Not under a million. I tested. It seems kind of tricky to prove this directly, because knowing the factorization of any of n, n+1, or 2n+1 doesn't tell you much about the factorizations of the others.

Let f(n) = n(n+1)(2n+1)/6; for what proportion of values of n is f(n) squarefree? For random integers it's π2/6. Let g(n) be the number of integers [1,n] such that f(n) is squarefree; then g(1000) = 504, g(10000) = 5029, g(100000) = 50187.

Hmm, it looks an awful lot like g(n) ~ n/2, doesn't it? I have no idea if this is true. It seems quite obvious that g(n) ~ cn for some constant c, but I'm not sure if c is exactly 1/2. (And I'd be surprised if it did come out to be 1/2; these sorts of probabilities are rarely rational.)


Anonymous said...

It looks like there are no other solutions :

Ori Gurel-Gurevich said...

Actually, I believe that c=(2/3)*(\prod_{p>3, p prime} (1-3/p^2)) =~0.501948

I. J. Kennedy said...

Hey ori,
Any chance of a proof?

Ori Gurel-Gurevich said...

Proof sketch:
The idea is to check whether n(n+1)(2n+1)/6 is 0 modulu p^2 for every prime p. This is similar to the analysis of the probability of an integer to be squarefree, which is \prod_p (1-1/p^2) = 6/pi^2

So, for all prime p>3 we get (1-3/p^2) because there are exactly 3 values of n mod p^2 yielding 0, which are 0, -1 and -1/2. For p=3 we need to work modulo 27 instead because we lose a factor of 3 when dividing by 6, so we get (1-3/27). For 2 we work modulo 8 so there's no -1/2 so we get (1-2/8).

I guess that this number is indeed transcendental, though I didn't actually bother to prove it.

Anonymous said...

Google "Leech Lattice", a very neat lattice in 24 dimensions that has some amazing properties.

Anonymous said...

ftlus insults eliminated tours mozambique equipment receipts families kinship joplin studios
servimundos melifermuly