A348476 Number of compositions of n into exactly n nonnegative parts such that all positive parts are odd.
1, 1, 1, 4, 13, 36, 106, 323, 981, 2992, 9196, 28392, 87946, 273287, 851579, 2659764, 8324357, 26100560, 81969496, 257800532, 811862268, 2559731360, 8079294664, 25525787344, 80719066698, 255466082911, 809138591431, 2564605664428, 8134003910311, 25813957574292
Offset: 0
Keywords
Examples
a(0) = 1: []. a(1) = 1: [1]. a(2) = 1: [1,1]. a(3) = 4: [3,0,0], [0,3,0], [0,0,3], [1,1,1]. a(4) = 13: [3,1,0,0], [3,0,1,0], [3,0,0,1], [1,3,0,0], [0,3,1,0], [0,3,0,1],[1,0,3,0], [0,1,3,0], [0,0,3,1], [1,0,0,3], [0,1,0,3], [0,0,1,3], [1,1,1,1].
Links
- Alois P. Heinz, Table of n, a(n) for n = 0..1968
Programs
-
Maple
b:= proc(n, t) option remember; `if`(t=0, 1-signum(n), add(`if`(j=0 or j::odd, b(n-j, t-1), 0), j=0..n)) end: a:= n-> b(n$2): seq(a(n), n=0..30);
-
Mathematica
b[n_, t_] := b[n, t] = If[t == 0, 1 - Sign[n], Sum[If[j == 0 || OddQ[j], b[n - j, t - 1], 0], {j, 0, n}]]; a[n_] := b[n, n]; Table[a[n], {n, 0, 30}] (* Jean-François Alcover, May 16 2022, after Alois P. Heinz *)
Formula
a(n) ~ c * d^n / sqrt(Pi*n), where d = 3.22870495109450172934784925586... is largest positive root of the equation 4*d^4 - 12*d^3 + 4*d^2 - 24*d + 5 = 0 and c = 0.4302331663731241127284415754... is positive root of the equation 5824*c^8 - 32*c^4 - 4*c^2 - 5 = 0. - Vaclav Kotesovec, Nov 01 2021