# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a112104 Showing 1-1 of 1 %I A112104 #11 Nov 05 2019 10:02:39 %S A112104 1,2,2,1,2,1,2,2,1,2,1,2,2,2,2,2,1,1,1,1,1,2,2,1,1,1,2,2,1,2,1,2,2,1, %T A112104 1,1,1,1,2,2,2,1,1,1,2,2,2,2,1,1,2,2,1,2,2,2,2,1,1,1,2,1,1,2,1,1,2,2, %U A112104 2,2,1,1,1,2,2,2,2,2,1,1,2,2,1,2,2,2,2,1,2,2,2,2,1,2,1,1,1,2,1,2,1,2,2,2,1 %N A112104 Unique sequence of 1's and 2's where g.f. A(x) satisfies A(x) = B(B(x)) such that B(x) is an integer series, with A(0) = 0. %H A112104 Paul D. Hanna, Table of n, a(n) for n = 1..512 %e A112104 G.f.: A(x) = x + 2*x^2 + 2*x^3 + x^4 + 2*x^5 + x^6 +... %e A112104 then A(x) = B(B(x)) where %e A112104 B(x) = x + x^2 + x^5 - 3*x^6 + 7*x^7 - 10*x^8 - 5*x^9 +... %e A112104 is the g.f. of A112105. %t A112104 kmax = 105; %t A112104 A[x_] := Sum[a[k] x^k, {k, kmax}]; %t A112104 B[x_] := Sum[b[k] x^k, {k, kmax}]; %t A112104 sol = {a[1] -> 1, b[1] -> 1}; %t A112104 Do[Print["k = ", k]; sc = SeriesCoefficient[B[(B[x] /. sol) + O[x]^(k+1)] - A[x], {x, 0, k}] /. sol; r = Reduce[(a[k] == 1 || a[k] == 2) && sc == 0, {a[k], b[k]}, Integers]; sol = Join[r // ToRules, sol], {k, 2, kmax}]; %t A112104 a /@ Range[kmax] /. sol (* _Jean-François Alcover_, Nov 05 2019 *) %o A112104 (PARI) {a(n,m=2)=local(F=x+x^2+x*O(x^n),G);if(n<1,0, for(k=3,n, G=F+x*O(x^k);for(i=1,m-1,G=subst(F,x,G)); F=F-((polcoeff(G,k)-1)\m)*x^k); G=F+x*O(x^n);for(i=1,m-1,G=subst(F,x,G)); return(polcoeff(G,n,x)))} %Y A112104 Cf. A112105, A112106-A112127. %K A112104 nonn %O A112104 1,2 %A A112104 _Paul D. Hanna_, Aug 27 2005 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE