A121238 a(n) = (-1)^(1+n+A088585(n)).
1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1
Offset: 0
This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
For n = 4, the a(4) = 14 solutions are 0000, 0001, 0010, 0100, 1000, 0101, 1001, 1010, 0011, 0110, 1100, 1011, 1101, and 1111.
a:= proc(n) option remember; `if`(n<1, 1, a(n-1) +add(a(n-1-2^k), k=0..ilog2(n))) end: seq(a(n), n=0..50); # Alois P. Heinz, Jan 03 2015
terms = 35; h[x_] = Sum[x^2^k, {k, 0, Log[2, terms] // Floor}]; CoefficientList[(1 + h[x])/(1 - x - x h[x]) + O[x]^terms, x] (* Jean-François Alcover, Mar 22 2019, after Robert Israel *)
nmax = 35; CoefficientList[Series[x D[1/(1 - Sum[x^2^k, {k, 0, Floor[Log[nmax]/Log[2]] + 1}]), x], {x, 0, nmax}], x] a[0] = 1; a[n_] := a[n] = Sum[Boole[k == 2^IntegerExponent[k, 2]] a[n - k], {k, 1, n}]; Table[n a[n], {n, 0, 35}]
a(5) = 6 because we have [4, 1], [1, 4], [2, 1, 1, 1], [1, 2, 1, 1], [1, 1, 2, 1] and [1, 1, 1, 2].
b:= proc(n, t) option remember; `if`(n=0, t, add(b(n-2^i, 1-t), i=0..ilog2(n))) end: a:= n-> b(n, 1): seq(a(n), n=0..42); # Alois P. Heinz, Dec 03 2020
nmax = 38; CoefficientList[Series[(1/2) (1/(1 - Sum[x^(2^k), {k, 0, Floor[Log[2, nmax]] + 1}]) + 1/(1 + Sum[x^(2^k), {k, 0, Floor[Log[2, nmax]] + 1}])), {x, 0, nmax}], x]
a(5) = 4 because we have [2, 2, 1], [2, 1, 2], [1, 2, 2] and [1, 1, 1, 1, 1].
b:= proc(n, t) option remember; `if`(n=0, t, add(b(n-2^i, 1-t), i=0..ilog2(n))) end: a:= n-> b(n, 0): seq(a(n), n=0..42); # Alois P. Heinz, Dec 03 2020
nmax = 38; CoefficientList[Series[(1/2) (1/(1 - Sum[x^(2^k), {k, 0, Floor[Log[2, nmax]] + 1}]) - 1/(1 + Sum[x^(2^k), {k, 0, Floor[Log[2, nmax]] + 1}])), {x, 0, nmax}], x]
b:= proc(n) option remember; `if`(n=0, 1, add(b(n-2^i), i=0..ilog2(n))) end: a:= n-> b(n)-`if`(2^ilog2(n)=n, 1, 0): seq(a(n), n=0..50); # Alois P. Heinz, Oct 02 2022
b[n_] := b[n] = If[n == 0, 1, Sum[b[n - 2^i], {i, 0, Floor@ Log2[n]}]]; a[n_] := b[n] - If[2^Floor@Log2[n] == n, 1, 0]; Table[a[n], {n, 0, 50}] (* Jean-François Alcover, Dec 26 2022, after Alois P. Heinz *)
b:= proc(n, t) option remember; `if`(n=0, 1, add(b(n-2^j, t), j=0..min(ilog2(n), t))) end: a:= n-> b(n, ilog2(floor(sqrt(n)))): seq(a(n), n=0..37); # Alois P. Heinz, Jan 18 2024
Table[SeriesCoefficient[1/(1 - Sum[Boole[IntegerQ[Log[2, k]]] x^k, {k, 1, Floor[Sqrt[n]]}]), {x, 0, n}], {n, 0, 37}]
First few rows of the triangle = 1; 1, 1; 0, 1, 2; 1, 0, 2, 3; 0, 1, 0, 3, 6; 0, 0, 2, 0, 6, 10; 0, 0, 0, 3, 0, 10, 18; 1, 0, 0, 0, 6, 0, 18, 31; 0, 1, 0, 0, 0, 10, 0, 31, 56; 0, 0, 2, 0, 0, 0, 18, 0, 56; 98; 0, 0, 0, 3, 0, 0, 0, 31, 0, 98, 174; 0, 0, 0, 0, 6, 0, 0, 0, 56, 0, 174, 306; ... Row 4 = (1, 0, 2, 3) = termwise products of (1, 0, 1, 1) and (1, 1, 2, 3).
For n = 4 the a(4) = 5 compositions are 1+1+1+1, 1+1+2, 2+1+1, 2+2, and 4. The composition 1+2+1 is not allowed, because 2 does not divide the sum of previous terms.
Comments