Observe that the sum and apply it to the Cartesian plane. We can see that it is basically calculating the distance between the origin and n points.
Therefore, we can assume every (2k−1)2+ak2 to be a vector from the origin to point (2k−1,ak).
Now we can take the sum inside the vector space and get ((1+3+5+…+(2n−1))2+(a12+a22+…+an2))1/2 (by the Triangle Inequality, this is always less than or equal to the original sum). Note that 1+3+…+(2n−1)=n2.
We are given that a12+a22+…+an2=17, so Sn≥n4+17. We can achieve equality by taking a1=a2=…=an=n17.
In this case, all the points would be on a circle centered at the origin with radius n2+n17=nn3+17. Thus, Sn=n4+17 if and only if n3+17 is a perfect square.
We can now check small values of n. We see that n=2 does not work, n=3 does not work, but n=4 does work, since 43+17=89 is a perfect square.
e can prove that there are no other solutions by Method of Descent. Suppose there exists another solution n′>4. Then (n′)3+17>43+17=89, so (n′)3>89.
By Integer Root Theorem, the only possible integer roots of (n′)3−89 are 1 and −1. We can quickly check that neither 1 nor −1 is a root.
This forces (n′)3−89 to be prime. However, this is impossible because (n′−4)(n′2+4n+22) divides (n′)3−89, and both factors on the right are greater than 1.
Thus, n=4 is the unique solution.