Computing and completing the square, we find
n1k=m∑m+n−1k2=m2+(n−1)m+6(n−1)(2n−1)=(m+2n−1)2+12n2−1
is a perfect square.
Since n2−1 modulo 8 is either 0 or odd, 12n2−1 must be even. Also, from the above equation we know that 12n2−1 is the difference of two perfect squares, and since it is even, it must therefore be a multiple of 4. Hence we obtain n2≡1(mod48), so n can only be of the form 24p±1,24p±7.
Conversely, if n is a positive integer of the form 24p±1,24p±7, then n2≡1(mod48). There exists a nonnegative integer a such that 12n2−1=4a. Take m=a−1−2n−1, then
n1k=m∑m+n−1k2=(m+2n−1)2+12n2−1=(a−1)2+4a=(a+1)2.