|
|
A349052
|
|
Number of weakly alternating compositions of n.
|
|
28
|
|
|
1, 1, 2, 4, 8, 16, 28, 52, 91, 161, 280, 491, 850, 1483, 2573, 4469, 7757, 13472, 23378, 40586, 70438, 122267, 212210, 368336, 639296, 1109620, 1925916, 3342755, 5801880, 10070133, 17478330, 30336518, 52653939, 91389518, 158621355, 275313226, 477850887, 829388075
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
We define a sequence to be weakly alternating if it is alternately weakly increasing and weakly decreasing, starting with either. A sequence is alternating iff it is a weakly alternating anti-run.
|
|
LINKS
|
|
|
EXAMPLE
|
The a(5) = 16 compositions:
(1,1,1,1,1) (1,1,1,2) (1,1,3) (1,4) (5)
(1,1,2,1) (1,2,2) (2,3)
(1,2,1,1) (1,3,1) (3,2)
(2,1,1,1) (2,1,2) (4,1)
(2,2,1)
(3,1,1)
The a(6) = 28 compositions:
(111111) (11112) (1113) (114) (15) (6)
(11121) (1122) (132) (24)
(11211) (1131) (141) (33)
(12111) (1212) (213) (42)
(21111) (1311) (222) (51)
(2121) (231)
(2211) (312)
(3111) (411)
|
|
MATHEMATICA
|
whkQ[y_]:=And@@Table[If[EvenQ[m], y[[m]]<=y[[m+1]], y[[m]]>=y[[m+1]]], {m, 1, Length[y]-1}];
Table[Length[Select[Join@@Permutations/@IntegerPartitions[n], whkQ[#]||whkQ[-#]&]], {n, 0, 10}]
|
|
PROG
|
(PARI)
C(n, f)={my(M=matrix(n, n, j, k, k>=j), s=M[, n]); for(b=1, n, f=!f; M=matrix(n, n, j, k, if(k<j, if(f, M[j-k, k], M[j-k, n]-if(k>1, M[j-k, k-1]) ))); for(k=2, n, M[, k]+=M[, k-1]); s+=M[, n]); s~}
seq(n) = concat([1], C(n, 0) + C(n, 1) - vector(n, j, numdiv(j))) \\ Andrew Howroyd, Jan 31 2024
|
|
CROSSREFS
|
The version for permutations of prime indices is A349056, strong A345164.
A001700 counts compositions of 2n with alternating sum 0.
A003242 counts Carlitz (anti-run) compositions.
A106356 counts compositions by number of maximal anti-runs.
A344604 counts alternating compositions with twins.
A345170 counts partitions w/ an alternating permutation, ranked by A345172.
A349054 counts strict alternating compositions.
Cf. A000041, A008965, A102726, A114901, A128761, A261983, A333213, A333755, A344614, A344615, A345165, A345195.
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|