login
Number of compositions (ordered partitions) of n into 2 or more distinct nonnegative parts.
1

%I #45 Mar 05 2021 07:31:42

%S 0,2,2,10,10,18,48,56,86,124,298,336,540,722,1070,2122,2614,3810,5316,

%T 7496,9986,18940,22558,33336,44568,63074,82034,114754,187642,234690,

%U 328536,441872,602006,794020,1072546,1389408,2207532,2706266,3752462,4900474,6681022,8574906

%N Number of compositions (ordered partitions) of n into 2 or more distinct nonnegative parts.

%C If permutations are considered equivalent then a(n)=A087135(n)=2*A000009(n) for n>0.

%C All terms are even. - _Alois P. Heinz_, Aug 18 2018

%H Alois P. Heinz, <a href="/A216708/b216708.txt">Table of n, a(n) for n = 0..5000</a>

%H César Eliud Lozada, <a href="/A216708/a216708.pdf">Illustration for terms up to n=9</a>

%F From _Joerg Arndt_, Sep 17 2012: (Start)

%F G.f. sum(k>=0, (k+1)!*x^((k^2+k)/2) / prod(j=1..k+1, 1-x^j)) - 1/(1-x);

%F explanation: the g.f. for partitions into at least two positive parts (A111133) is

%F sum(k>=0, x^((k^2+k)/2) / prod(j=1..k, 1-x^j)) - 1/(1-x)

%F (i.e., the g.f. of A000009 minus the g.f. 1/(1-x) for the constant sequence a(n)=1 that counts the single partition n = [n]);

%F the factor (k+1)! in the g.f. of this function provides for the permutations of the parts, including a zero.

%F (End)

%e a(2)=2 because 2 = 0+2 = 2+0 (2 ways)

%e a(3)=10 because 3 = 0+3 = 1+2 = 2+1 = 3+0 = 0+1+2 = 0+2+1 = 1+0+2 = 1+2+0 = 2+0+1 = 2+1+0 (10 ways)

%p b:= proc(n, i, p) option remember; (m-> `if`(m<n, 0, `if`(n=0,

%p `if`(p=0, 0, `if`(p=1, 2, p!*(p+2))), b(n, i-1, p)+

%p b(n-i, min(n-i, i-1), p+1))))(i*(i+1)/2)

%p end:

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

%p seq(a(n), n=0..42); # _Alois P. Heinz_, Aug 18 2018

%t b[n_, i_, p_] := b[n, i, p] = With[{m = i(i+1)/2}, If[m < n, 0, If[n == 0,

%t If[p == 0, 0, If[p == 1, 2, p! (p+2)]], b[n, i-1, p] +

%t b[n-i, Min[n-i, i-1], p+1]]]];

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

%t a /@ Range[0, 42] (* _Jean-François Alcover_, Mar 05 2021, after _Alois P. Heinz_ *)

%o (PARI)

%o N=66; x='x+O('x^N);

%o gf=sum(k=0,N, (k+1)!*x^((k^2+k)/2) / prod(j=1,k+1, 1-x^j)) - 1/(1-x);

%o v=Vec(gf);

%o vector(#v+1,n,if(n==1,0,v[n-1]))

%o /* _Joerg Arndt_, Sep 17 2012 */

%Y Cf. A216695, A087135, A000009, A032020.

%K nonn

%O 0,2

%A _César Eliud Lozada_, Sep 16 2012

%E More terms, _Joerg Arndt_, Sep 17 2012