OFFSET
1,3
LINKS
FORMULA
a(n) = 2^(n-2)-2^((n-2)/2) if n is even, else a(n) = 2^(n-2)+2^((n-3)/2).
G.f.: z(1-z)^2/[(1-2z)(1-2z^2)]. - Emeric Deutsch, Feb 03 2006
G.f.: 1 + x + Q(0), where Q(k)= 1 - 1/(2^k - 2*x*2^(2*k)/(2*x*2^k - 1/(1 + 1/(2*2^k - 8*x*2^(2*k)/(4*x*2^k + 1/Q(k+1)))))); (continued fraction). - Sergei N. Gladkovskii, May 22 2013
EXAMPLE
a(4)=2 because only the compositions 31 and 13 of 4 have an odd number of 1's (the other compositions are 4,22,211,121,112 and 1111).
MAPLE
a:=proc(n) if n mod 2 = 0 then 2^(n-2)-2^((n-2)/2) else 2^(n-2)+2^((n-3)/2) fi end: seq(a(n), n=1..38); # Emeric Deutsch, Feb 01 2006
MATHEMATICA
f[n_] := If[EvenQ[n], 2^(n - 2) - 2^((n - 2)/2), 2^(n - 2) + 2^((n - 3)/2)]; Array[f, 34] (* Robert G. Wilson v, Feb 01 2006 *)
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Vladeta Jovovic, Jan 31 2006
EXTENSIONS
More terms from Robert G. Wilson v and Emeric Deutsch, Feb 01 2006
STATUS
approved