OFFSET
3,1
COMMENTS
Let j be the smallest integer for which 1 + (1+1*n) + (1+2*n) + ... + (1+j*n) = k^2 = s. Then a(n)=k; if no such j exists, then a(n)=0. Basis for sequence is shortest arithmetic series with initial term 1 and difference n that sums to a perfect square.
FORMULA
EXAMPLE
a(3)=99 since 1 + 4 + 7 + ... + (1+80*3) = 99^2 = 9801 and no other arithmetic series with initial term 1, difference 3 and fewer terms sums to a perfect square.
MATHEMATICA
NgonIndex[n_, v_] := (-4 + n + Sqrt[16 - 8*n + n^2 - 16*v + 8*n*v])/(n - 2)/2; Table[k = 2; While[sqr = k^2; i = NgonIndex[n, sqr]; k < 25000 && ! IntegerQ[i], k++]; If[k == 25000, k = sqr = i = 0]; k, {n, 3, 64}] (* T. D. Noe, Apr 19 2011 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Charlie Marion, Nov 21 2004
STATUS
approved