login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Number of compositions of n into exactly n nonnegative parts such that each positive i-th part has the same parity as i.
2

%I #14 Apr 14 2022 07:47:43

%S 1,1,1,4,7,23,55,164,407,1235,3051,9432,23431,72989,182624,571384,

%T 1436855,4511979,11387467,35866100,90782837,286622226,727226578,

%U 2300578392,5848776767,18533394763,47197285045,149769168304,381956145802,1213526310665,3098742448230

%N Number of compositions of n into exactly n nonnegative parts such that each positive i-th part has the same parity as i.

%H Alois P. Heinz, <a href="/A348478/b348478.txt">Table of n, a(n) for n = 0..2169</a>

%e a(0) = 1: [].

%e a(1) = 1: [1].

%e a(2) = 1: [0,2].

%e a(3) = 4: [1,2,0], [0,2,1], [3,0,0], [0,0,3].

%e a(4) = 7: [1,2,1,0], [1,0,1,2], [3,0,1,0], [1,0,3,0], [0,2,0,2], [0,4,0,0], [0,0,0,4].

%p b:= proc(n, t) option remember; `if`(t=0, 1-signum(n),

%p add(`if`(j=0 or (t-j)::even, b(n-j, t-1), 0), j=0..n))

%p end:

%p a:= n-> b(n$2):

%p seq(a(n), n=0..33);

%t b[n_, t_] := b[n, t] = If[t == 0, 1 - Sign[n],

%t Sum[If[j == 0 || EvenQ[t - j], b[n - j, t - 1], 0], {j, 0, n}]];

%t a[n_] := b[n, n];

%t Table[a[n], {n, 0, 33}] (* _Jean-François Alcover_, Apr 14 2022, after _Alois P. Heinz_ *)

%Y Cf. A001700, A062200, A088218, A122514, A165817, A305161, A324969, A348476.

%K nonn

%O 0,4

%A _Alois P. Heinz_, Oct 20 2021