OFFSET
1,12
COMMENTS
LINKS
Alois P. Heinz and Ray Chandler, Table of n, a(n) for n = 1..500 (first 240 terms from Alois P. Heinz)
T. D. Noe, Extremal Sums of Sequences
FORMULA
a(n) is half the coefficient of x^0 in the product_{k=1..n} x^(k^2)+x^(k^-2).
a(n) = A158092(n)/2.
a(n) = [x^(n^2)] Product_{k=1..n-1} (x^(k^2) + 1/x^(k^2)). - Ilya Gutkovskiy, Feb 01 2024
EXAMPLE
a(7) = 1 because there is only one sign pattern of the first seven squares that yields zero: 1+4-9+16-25-36+49.
MAPLE
b:= proc(n, i) option remember; local m;
m:= (1+(3+2*i)*i)*i/6;
`if`(n>m, 0, `if`(n=m, 1, b(abs(n-i^2), i-1) +b(n+i^2, i-1)))
end:
a:= n-> `if`(irem(n-1, 4)<2, 0, b(n^2, n-1)):
seq(a(n), n=1..40); # Alois P. Heinz, Oct 31 2011
MATHEMATICA
d={1, 1}; nMax=60; zeroLst={0}; Do[p=n^2; d=PadLeft[d, Length[d]+p]+PadRight[d, Length[d]+p]; If[1==Mod[Length[d], 2], AppendTo[zeroLst, d[[(Length[d]+1)/2]]], AppendTo[zeroLst, 0]], {n, 2, nMax}]; zeroLst/2
p = 1; t = {}; Do[p = Expand[p(x^(n^2) + x^(-n^2))]; AppendTo[t, Select[p, NumberQ[ # ] &]/2], {n, 51}]; t (* Robert G. Wilson v, Oct 31 2005 *)
PROG
(PARI) a(n)=sum(i=0, 2^(n-1)-1, sum(j=1, n-1, (-1)^bittest(i, j-1)*j^2)==n^2) \\ Charles R Greathouse IV, Nov 05 2012
CROSSREFS
KEYWORD
nonn
AUTHOR
T. D. Noe, Apr 29 2003
STATUS
approved