OFFSET
0
COMMENTS
It appears that if the value of a(n) results in the least sum of squares of coefficients in P(n,x)^n, then it also results in the least sum of squares of coefficients in P(n,x)^k for all k>n.
EXAMPLE
G.f.: A(x) = 1 + x - x^2 + x^3 + x^4 + x^5 - x^6 + x^7 - x^8 - x^9 - x^10 - x^11 + x^12 + x^13 - x^14 + x^15 - x^16 - x^17 - x^18 - x^19 + x^20 +...
Illustrate generating method.
Given P(1,x) = 1+x, to determine a(2), we compare the coefficients in (P(1,x) + x^2)^2 to (P(1,x) - x^2)^2 to see which has the least sum of squares of coefficients:
(1+x+x^2)^2 = 1 + 2*x + 3*x^2 + 2*x^3 + x^4;
(1+x-x^2)^2 = 1 + 2*x - x^2 - 2*x^3 + x^4;
the sum of squares of coefficients is 19 and 11, respectively; thus a(2) = -1 since it yields the least sum of squares.
Then since P(2,x) = 1+x-x^2, to determine a(3), we compare the coefficients in (P(2,x) + x^3)^3 to (P(2,x) - x^3)^3 to see which has the least sum of squares of coefficients:
(1+x-x^2+x^3)^3 = 1 + 3*x - 2*x^3 + 6*x^4 - 4*x^6 + 6*x^7 - 3*x^8 + x^9;
(1+x-x^2-x^3)^3 = 1 + 3*x - 8*x^3 - 6*x^4 + 6*x^5 + 8*x^6 - 3*x^8 - x^9;
the sum of squares of coefficients is 112 and 220, respectively; thus a(3) = +1 since it yields the least sum of squares. (Should they ever equal, choose +1 as the new term.)
Continuing in this way generates all the terms of this sequence.
PROG
(PARI) {A=[1, 1]; print1("1, 1, "); for(i=1, 60,
A=concat(A, y); P=truncate(Ser(A));
SUMSQ=Vec(P^(#A))*Vec(P^(#A))~;
SNEG=subst(SUMSQ, y, -1); SPOS=subst(SUMSQ, y, 1);
if(SNEG>=SPOS, t=1, t=-1); A[#A]=t; print1(t, ", "); )}
CROSSREFS
KEYWORD
sign
AUTHOR
Paul D. Hanna, Nov 25 2013
STATUS
approved