A246691 Number of compositions of n into parts of the n-th list of distinct parts in the order given by A246688.
1, 1, 1, 3, 0, 4, 0, 5, 4, 0, 274, 11, 13, 0, 1601, 21, 11, 10, 0, 15571, 7921, 53, 41, 12, 1, 246441, 64208, 119, 16169, 47, 89, 35, 0, 1439975216, 17319590, 1835123, 956698, 531, 274291, 0, 82, 0, 0, 428262742476, 1923714115, 72992449, 20086406, 1915, 4051405
Offset: 0
Examples
a(7) = 5 because there are 5 compositions of 7 into parts 1, 4: [1,1,1,1,1,1,1], [1,1,1,4], [1,1,4,1], [1,4,1,1], [4,1,1,1].
Links
- Alois P. Heinz, Table of n, a(n) for n = 0..1260
Programs
-
Maple
b:= proc(n, i) b(n, i):= `if`(n=0, [[]], `if`(i>n, [], [map(x->[i, x[]], b(n-i, i+1))[], b(n, i+1)[]])) end: f:= proc() local i, l; i, l:=0, []; proc(n) while n>=nops(l) do l:=[l[], b(i, 1)[]]; i:=i+1 od; l[n+1] end end(): g:= proc(n, l) option remember; `if`(n=0, 1, add(`if`(i>n, 0, g(n-i, l)), i=l)) end: a:= n-> g(n, f(n)): seq(a(n), n=0..80);
-
Mathematica
b[n_, i_] := b[n, i] = If[n == 0, {{}}, If[i > n, {}, Join[Prepend[#, i]& /@ b[n - i, i + 1], b[n, i + 1]]]]; f = Module[{i = 0, l = {}}, Function[n, While[n >= Length[l], l = Join[l, b[i, 1]]; i++]; l[[n + 1]]]]; g[n_, l_] := g[n, l] = If[n == 0, 1, Sum[If[i>n, 0, g[n - i, l]], {i, l}]]; a[n_] := g[n, f[n]]; Table[a[n], {n, 0, 80}] (* Jean-François Alcover, Jul 12 2021, after Alois P. Heinz *)
Formula
a(n) = A246690(n,n).
Comments