OFFSET
0,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..4623 (first 1001 terms from Andrew Howroyd)
EXAMPLE
The a(1) = 1 through a(6) = 17 compositions:
(1) (2) (3) (4) (5) (6)
(11) (12) (22) (122) (24)
(21) (112) (212) (33)
(111) (121) (221) (42)
(211) (1112) (222)
(1111) (1121) (1122)
(1211) (1212)
(2111) (1221)
(11111) (2112)
(2121)
(2211)
(11112)
(11121)
(11211)
(12111)
(21111)
(111111)
MAPLE
b:= proc(n, i) option remember; `if`(n=0, 1, add(
b(n-j, j), j=`if`(i=0, {$1..n}, select(x->
x::integer and x<=n, {i/2, i, 2*i}))))
end:
a:= n-> b(n, 0):
seq(a(n), n=0..42); # Alois P. Heinz, May 24 2021
MATHEMATICA
Table[Length[Select[Join@@Permutations/@IntegerPartitions[n], And@@Table[#[[i]]==#[[i-1]]||#[[i]]==2*#[[i-1]]||#[[i-1]]==2*#[[i]], {i, 2, Length[#]}]&]], {n, 0, 15}]
(* Second program: *)
b[n_, i_] := b[n, i] = If[n == 0, 1, Sum[b[n - j, j], {j, If[i == 0, Range[n], Select[ {i/2, i, 2 i}, IntegerQ[#] && # <= n &]]}]];
a[n_] := b[n, 0];
a /@ Range[0, 42] (* Jean-François Alcover, Jun 10 2021, after Alois P. Heinz *)
PROG
(PARI) seq(n)={my(M=matid(n)); for(k=1, n, for(i=1, k-1, M[i, k] = if(i%2==0, M[i/2, k-i]) + if(i*2<=k, M[i, k-i]) + if(i*3<=k, M[i*2, k-i]))); concat([1], sum(q=1, n, M[q, ]))} \\ Andrew Howroyd, Mar 13 2021
CROSSREFS
The case of partitions is A342337.
The anti-run version is A342331.
A000929 counts partitions with adjacent parts x >= 2y.
A002843 counts compositions with adjacent parts x <= 2y.
A154402 counts partitions with adjacent parts x = 2y.
A274199 counts compositions with adjacent parts x < 2y.
A342098 counts partitions with adjacent parts x > 2y.
A342332 counts compositions with adjacent parts x > 2y or y > 2x.
A342333 counts compositions with adjacent parts x >= 2y or y >= 2x.
A342334 counts compositions with adjacent parts x >= 2y or y > 2x.
A342335 counts compositions with adjacent parts x >= 2y or y = 2x.
A342338 counts compositions with adjacent parts x < 2y and y <= 2x.
KEYWORD
nonn
AUTHOR
Gus Wiseman, Mar 12 2021
EXTENSIONS
Terms a(21) and beyond from Andrew Howroyd, Mar 13 2021
STATUS
approved