login
Number of up/down (or down/up) compositions of n into distinct parts.
6

%I #27 Jan 18 2022 05:55:14

%S 1,1,1,2,2,3,5,6,8,11,18,21,30,38,52,78,97,128,170,222,285,421,510,

%T 683,872,1148,1440,1893,2576,3209,4151,5313,6784,8615,10969,13755,

%U 18573,22713,29173,36536,46705,57899,73696,91076,114777,148531,182813,228938,287042

%N Number of up/down (or down/up) compositions of n into distinct parts.

%C Original name was: Number of alternating compositions of n into distinct parts.

%C A composition is up/down if it is alternately strictly increasing and strictly decreasing, starting with an increase. - _Gus Wiseman_, Jan 15 2022

%H Alois P. Heinz, <a href="/A129838/b129838.txt">Table of n, a(n) for n = 0..10000</a>

%F G.f.: Sum_{k>=0} A000111(k)*x^(k*(k+1)/2)/Product_{i=1..k} (1-x^i). - _Vladeta Jovovic_, May 24 2007

%F a(n) = Sum_{k=0..A003056(n)} A000111(k) * A008289(n,k). - _Alois P. Heinz_, Dec 22 2021

%F a(n) = (A349054(n) + 1)/2. - _Gus Wiseman_, Jan 15 2022

%e From _Gus Wiseman_, Jan 15 2022: (Start)

%e The a(1) = 1 through a(8) = 8 up/down strict compositions (non-strict A025048):

%e (1) (2) (3) (4) (5) (6) (7) (8)

%e (1,2) (1,3) (1,4) (1,5) (1,6) (1,7)

%e (2,3) (2,4) (2,5) (2,6)

%e (1,3,2) (3,4) (3,5)

%e (2,3,1) (1,4,2) (1,4,3)

%e (2,4,1) (1,5,2)

%e (2,5,1)

%e (3,4,1)

%e The a(1) = 1 through a(8) = 8 down/up strict compositions (non-strict A025049):

%e (1) (2) (3) (4) (5) (6) (7) (8)

%e (2,1) (3,1) (3,2) (4,2) (4,3) (5,3)

%e (4,1) (5,1) (5,2) (6,2)

%e (2,1,3) (6,1) (7,1)

%e (3,1,2) (2,1,4) (2,1,5)

%e (4,1,2) (3,1,4)

%e (4,1,3)

%e (5,1,2)

%e (End)

%p g:= proc(u, o) option remember;

%p `if`(u+o=0, 1, add(g(o-1+j, u-j), j=1..u))

%p end:

%p b:= proc(n, k) option remember; `if`(k<0 or n<0, 0,

%p `if`(k=0, `if`(n=0, 1, 0), b(n-k, k)+b(n-k, k-1)))

%p end:

%p a:= n-> add(b(n, k)*g(k, 0), k=0..floor((sqrt(8*n+1)-1)/2)):

%p seq(a(n), n=0..60); # _Alois P. Heinz_, Dec 22 2021

%t whkQ[y_]:=And@@Table[If[EvenQ[m],y[[m]]<y[[m+1]],y[[m]]>y[[m+1]]],{m,1,Length[y]-1}];

%t Table[Length[Select[Join@@Permutations/@ Select[IntegerPartitions[n],UnsameQ@@#&],whkQ]],{n,0,15}] (* _Gus Wiseman_, Jan 15 2022 *)

%Y The case of permutations is A000111.

%Y This is the up/down case of A032020.

%Y This is the strict case of A129852/A129853, strong A025048/A025049.

%Y The undirected version is A349054.

%Y A001250 = alternating permutations, complement A348615.

%Y A003242 = Carlitz compositions, complement A261983.

%Y A011782 = compositions, unordered A000041.

%Y A025047 = alternating compositions, complement A345192.

%Y A349052 = weakly alternating compositions, complement A349053.

%Y Cf. A003056, A008289, A008965, A015723, A072706, A128761, A218074, A345165, A345170, A345195, A349800.

%K easy,nonn

%O 0,4

%A _Vladeta Jovovic_, May 21 2007

%E a(0)=1 prepended by _Alois P. Heinz_, Dec 22 2021

%E Name changed from "alternating" to "up/down" by _Gus Wiseman_, Jan 15 2022