(a) It is clear that it is enough to show that if n≥4, then n2 cannot be written as the sum of n2−13 positive squares. Suppose it can be written as:
n2=a12+a22+⋯+an2−132
where a1,⋯,an2−13≥1. Rearrange this as follows:
i=1∑n2−13(ai2−1)=13
If we show that 13 cannot be written as the sum of numbers of the form x2−1 (where x≥1), we are done. Since for x≥4, x2−1>13, the values of ai can only be 1, 2, and 3, meaning that on the left side of (1), every term is 0, 3, or 8.
If no 8 appears, then the sum is divisible by 3; if one 8 appears, then the sum gives a remainder of 2 when divided by 3; if at least two 8s appear, then the sum is at least 16. Since 13 gives a remainder of 1 when divided by 3 and is less than 16, the sum cannot be 13.
However, it is true - and we will use this in part (b) - that all integers greater than 13 can be written as the sum of numbers of the form x2−1, and even as the sum of 3s and 8s.
(b) Clearly, we need to find an n such that n2 can be written as the sum of more than two positive squares, i.e., n is the largest element of a Pythagorean triple. The smallest such numbers are:
5,10,13,15,17
It is easy to check that the squares of 5 and 10 cannot be written as the sum of three squares, so n=5 and n=10 are not suitable. However, we will show that n=13 is suitable. For this, since we have already proven statement (a), it is enough to show that S(13)⩾132−14=155, i.e., 132=169 can be written as the sum of 1, 2, 3, ..., 154, or exactly 155 positive squares.
Let k≤155 and try to write 169 as the sum of k positive squares:
a12+a22+⋯+ak2=169
where a1,…,ak≥1. Rearrange this similarly to (1):
i=1∑k(ai2−1)=169−k
Now we need to write the number 169−k as the sum of k numbers of the form x2−1. The numbers of the form x2−1 that are less than 169 are:
0,3,8,15,24,35,48,63,80,99,120,143,168
Let a1 be the largest positive integer such that
a12−1≤155−k
(such an integer exists because 155−k≥0), i.e.,
a_{1}^{2}-1= \begin{cases}0, & \text { if } 14 \leq 169-k \leq 16 \\ 3, & \text { if } 17 \leq 169-k \leq 21 \\ 8, & \text { if } 22 \leq 169-k \leq 28 \\ 15, & \text { if } 29 \leq 169-k \leq 37 \\ 24, & \text { if } 38 \leq 169-k \leq 48 \\ 35, & \text { if } 49 \leq 169-k \leq 61 \\ 48, & \text { if } 62 \leq 169-k \leq 76