Pyramid Of Spheres A collection of identical spheres can be formed into a “square” pyramid (a pyramid with a base (bottom layer) made up of $n \times n$ spheres whose next layer is made up of $(n-1) \times (n-1)$ spheres, continuing this way up to the top layer of one sphere). The same collection of spheres can also be formed into a single-layer $k \times k$ “square” where $k < 100$. 

Find the largest possible value of $k$ for such a collection of spheres.

It seems that the answer will be the square of a number less than $100$ and the approach I took was saying 
$$
k^2= 1+ 2^2+ ....(n-1)^2 + n^2
$$ 
since each "level" of the pyramid has exactly $n^2$ spheres for any given level $n$ of the pyramid. The sum of these layers or levels will be $k^2$
but how this sum can be evaluated is where Me stuck :(
 A: If we impose the bound $1<k<100$ (the problem implies more than one ball), then uniqueness can be solved easily without extensive computational effort or the full use of elliptic curves.
Start with the $n(n+1)(2n+1)/6$ formula for the sum of the first $n$ positive squares.  We must have this equal to a square $k^2$ itself, with $k<100$ so we infer $n^3<30,000$, thus $1<n<32$.
Then $n(n+1)(2n+1)=6k^2$ where all the factors on the left side are pairwise relatively prime.  Therefore $n$ must be $\in\{1,2,3,6\}$ times a perfect square, similarly for $n+1$ and $2n+1$.
We therefore rule out any cases where any of these factors is $\equiv 5\bmod 6$ as such a number cannot satisfy the constraint described above.  This forces $n\in \{0,1,3\}\bmod  6$.
If $n$ is multiple of $3$ then $2n+1$ must be odd, not a multiple of $3$ and hence a perfect square, and with $1<n<32$ this forces $n\in\{12,24\}$.  If $n\equiv 1\bmod 6$ then it must be a perfect square, and only $25$ among these possibilities is within the bounds $1<n<32$.  Then the only remaining possible values of $n$ which could give a sum of $k^2$ with $1<k<100$ are $12,24,25$.  The first and last of these give an unsquared factor of $13$ when substituted into $n(n+1)(2n+1)/6$, leaving $n=24,k=70$ as the sole survivor.
