OFFSET
1,4
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..1000
M. Archibald, A. Blecher, A. Knopfmacher, M. E. Mays, Inversions and Parity in Compositions of Integers, J. Int. Seq., Vol. 23 (2020), Article 20.4.1.
FORMULA
G.f.: (1-x)/(1-2*x) - Sum_{i>=1} ((x-1)*x^i*(-x^(i+1)+x^i-2*x+1)) / ((2*x-1) * (-2*x^(i+1)+2*x^i-2*x+1)).
EXAMPLE
For n=4, a(4)=4 and counts 2+2, 1+2+1, 1+1+2 and 1+1+1+1.
MAPLE
b:= proc(n, p, t) option remember; `if`(n=0, t,
add(b(n-j, p, `if`(p=j, 1-t, t)), j=1..n))
end:
a:= n-> add(b(n-j, j, 0), j=1..n):
seq(a(n), n=1..38); # Alois P. Heinz, Jan 23 2020
MATHEMATICA
gf[x_] := (1 - x)/(1 - 2 x) - Sum[ ((x - 1) x^i (-x^(i + 1) + x^i - 2 x + 1)) / ((2 x - 1) (-2 x^(i + 1) + 2 x^i - 2 x + 1)), {i, 1, 40}];
CL := CoefficientList[Series[gf[x], {x, 0, 35}], x]; Drop[CL, 1] (* Peter Luschny, Jan 23 2020 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Arnold Knopfmacher, Jan 22 2020
STATUS
approved