%I #26 Jan 31 2024 15:55:43
%S 1,1,2,3,5,7,13,19,30,48,76,118,187,293,461,725,1140,1789,2815,4422,
%T 6950,10924,17169,26979,42405,66644,104738,164610,258708,406588,
%U 639010,1004287,1578364,2480606,3898600,6127152,9629624,15134213,23785389,37381849,58750469
%N Number of alternating compositions of n, including twins (x,x).
%C We define a composition to be alternating including twins (x,x) if there are no adjacent triples (..., x, y, z, ...) where x <= y <= z or x >= y >= z. Except in the case of twins (x,x), all such compositions are anti-runs (A003242). These compositions avoid the weak consecutive patterns (1,2,3) and (3,2,1), the strict version being A344614.
%C The version without twins (x,x) is A025047 (alternating compositions).
%H Andrew Howroyd, <a href="/A344604/b344604.txt">Table of n, a(n) for n = 0..1000</a>
%F a(n > 0) = A025047(n) + 1 if n is even, otherwise A025047(n). - _Gus Wiseman_, Nov 03 2021
%e The a(1) = 1 through a(7) = 19 compositions:
%e (1) (2) (3) (4) (5) (6) (7)
%e (11) (12) (13) (14) (15) (16)
%e (21) (22) (23) (24) (25)
%e (31) (32) (33) (34)
%e (121) (41) (42) (43)
%e (131) (51) (52)
%e (212) (132) (61)
%e (141) (142)
%e (213) (151)
%e (231) (214)
%e (312) (232)
%e (1212) (241)
%e (2121) (313)
%e (412)
%e (1213)
%e (1312)
%e (2131)
%e (3121)
%e (12121)
%t Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],!MatchQ[#,{___,x_,y_,z_,___}/;x<=y<=z||x>=y>=z]&]],{n,0,15}]
%Y A001250 counts alternating permutations.
%Y A005649 counts anti-run patterns.
%Y A025047 counts alternating or wiggly compositions, also A025048, A025049.
%Y A106356 counts compositions by number of maximal anti-runs.
%Y A114901 counts compositions where each part is adjacent to an equal part.
%Y A325534 counts separable partitions.
%Y A325535 counts inseparable partitions.
%Y A344605 counts alternating patterns including twins.
%Y A344606 counts alternating permutations of prime factors including twins.
%Y Counting compositions by patterns:
%Y - A011782 no conditions.
%Y - A003242 avoiding (1,1) adjacent.
%Y - A102726 avoiding (1,2,3).
%Y - A106351 avoiding (1,1) adjacent by sum and length.
%Y - A128695 avoiding (1,1,1) adjacent.
%Y - A128761 avoiding (1,2,3) adjacent.
%Y - A232432 avoiding (1,1,1).
%Y - A335456 all patterns.
%Y - A335457 all patterns adjacent.
%Y - A335514 matching (1,2,3).
%Y - A344614 avoiding (1,2,3) and (3,2,1) adjacent.
%Y - A344615 weakly avoiding (1,2,3) adjacent.
%Y Cf. A000041, A006330, A008965, A238279, A239830, A333213, A238279/A333755, A344612, A344616, A344617, A344618.
%K nonn
%O 0,3
%A _Gus Wiseman_, May 27 2021
%E a(21)-a(40) from _Alois P. Heinz_, Nov 04 2021
|