A349800 Number of integer compositions of n that are weakly alternating and have at least two adjacent equal parts.
0, 0, 1, 1, 4, 9, 16, 33, 62, 113, 205, 373, 664, 1190, 2113, 3744, 6618, 11683, 20564, 36164, 63489, 111343, 195042, 341357, 596892, 1042976, 1821179, 3178145, 5543173, 9663545, 16839321, 29332231, 51075576, 88908912, 154722756, 269186074, 468221264
Offset: 0
Keywords
Examples
The a(2) = 1 through a(6) = 16 compositions: (1,1) (1,1,1) (2,2) (1,1,3) (3,3) (1,1,2) (1,2,2) (1,1,4) (2,1,1) (2,2,1) (2,2,2) (1,1,1,1) (3,1,1) (4,1,1) (1,1,1,2) (1,1,1,3) (1,1,2,1) (1,1,2,2) (1,2,1,1) (1,1,3,1) (2,1,1,1) (1,3,1,1) (1,1,1,1,1) (2,2,1,1) (3,1,1,1) (1,1,1,1,2) (1,1,1,2,1) (1,1,2,1,1) (1,2,1,1,1) (2,1,1,1,1) (1,1,1,1,1,1)
Links
- Andrew Howroyd, Table of n, a(n) for n = 0..1000
- Wikipedia, Alternating permutation
Crossrefs
Programs
-
Mathematica
wigQ[y_]:=Or[Length[y]==0,Length[Split[y]]==Length[y] &&Length[Split[Sign[Differences[y]]]]==Length[y]-1]; 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[-#])&&!wigQ[#]&]],{n,0,10}]
Formula
Extensions
a(21) onwards from Andrew Howroyd, Jan 31 2024
Comments