Saturday 14 November 2015

Sums of Squares

I was prompted to investigate this one when I was checking the OEIS for the prime number 24329 that arose from my daily count of the number of days that I've been breathing in Earth's air. One entry reported that 24329 is a member of sequence A100559 that lists the smallest prime equal to the sum of n distinct squares. 24329 appeared in the case of n=41 so this prime was the smallest one that was equal to the sum of 41 distinct squares. The members of the sequence, up to 24329, are:

5, 29, 71, 79, 131, 179, 269, 349, 457, 569, 719, 971, 1171, 1327, 1601, 1913, 2269, 2593, 2999, 3539, 4099, 4549, 5231, 5717, 6529, 7297, 7879, 8779, 9791, 10711, 11867, 12809, 14081, 15269, 16561, 17863, 19463, 20771, 22541, 24329

The sequence begins with 5 for the case of n=2 where \(1^2+2^2=5\). The examples shown in the OEIS entry are as follows:

\(a(3)=29 \text{ because } 29=2^2+3^2+4^2\)
\(a(4) = 71 = 1^2+3^2+5^2+6^2\)
\(a(5)=79 \text{ because } 79=1^2+2^2+3^2+4^2+7^2\)

It can be seen that the squared numbers do not necessarily need to include 1 nor all of the numbers between 1 and n. It can even include numbers greater than n. For example, 29 (when n=3) does not include 1; 71 (when n=4) begins with 1 but does not include 4 but includes 5 and 6; 79 (when n=5) includes 1, 2, 3, 4 and 7 (but not 5 or 6). 

Interestingly, if the squares of the first n numbers are added together, they do not add to a prime number for the cases n=2 to 42. It may be a mathematical fact that the sum of the squares of the integers in sequence can never add to a prime number. In the list below, I've worked out these sums in Excel and put them in the central column with the corresponding primes from OEIS A100559 in the right-hand column:

1 1
2 5 5
3 14 29
4 30 71
5 55 79
6 91 131
7 140 179
8 204 269
9 285 349
10 385 457
11 506 569
12 650 719
13 819 971
14 1015 1171
15 1240 1327
16 1496 1601
17 1785 1913
18 2109 2269
19 2470 2593
20 2870 2999
21 3311 3539
22 3795 4099
23 4324 4549
24 4900 5231
25 5525 5717
26 6201 6529
27 6930 7297
28 7714 7879
29 8555 8779
30 9455 9791
31 10416 10711
32 11440 11867
33 12529 12809
34 13685 14081
35 14910 15269
36 16206 16561
37 17575 17863
38 19019 19463
39 20540 20771
40 22140 22541
41 23821 24329
42 25585 25913

It can be seen that the primes are always larger than the consecutive sums of squares to the left but not generally larger than the next sum (except in the case n=4 where 71 is larger than 55, the sum of the first 5 squares).

No comments:

Post a Comment