# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a342331 Showing 1-1 of 1 %I A342331 #25 May 09 2021 12:44:06 %S A342331 1,1,1,3,2,2,5,4,3,9,6,4,14,9,8,22,15,11,37,24,21,58,40,30,95,67,53, %T A342331 157,114,85,264,187,147,428,315,244,732,527,410,1207,892,681,2034, %U A342331 1490,1155,3416,2508,1927,5731,4215,3259,9597,7091,5454,16175,11914,9194,27134,20033,15425,45649,33672,25967,76714 %N A342331 Number of compositions of n where each part after the first is either twice or half the prior part. %C A342331 All quotients of adjacent parts are either 1/2 or 2. %H A342331 Alois P. Heinz, Table of n, a(n) for n = 0..5000 (first 1001 terms from Andrew Howroyd) %e A342331 The a(1) = 1 through a(12) = 14 compositions (A = 10, B = 11, C = 12): %e A342331 1 2 3 4 5 6 7 8 9 A B C %e A342331 12 121 212 24 124 242 36 424 21242 48 %e A342331 21 42 421 21212 63 12124 24212 84 %e A342331 1212 12121 1242 12421 2121212 363 %e A342331 2121 2124 42121 2424 %e A342331 2421 1212121 4242 %e A342331 4212 121242 %e A342331 121212 124212 %e A342331 212121 212124 %e A342331 212421 %e A342331 242121 %e A342331 421212 %e A342331 12121212 %e A342331 21212121 %p A342331 b:= proc(n, i) option remember; `if`(n=0, 1, add(b(n-j, j), j= %p A342331 `if`(i=0, 1..n, select(t-> t::integer and t<=n, {2*i, i/2})))) %p A342331 end: %p A342331 a:= n-> b(n, 0): %p A342331 seq(a(n), n=0..80); # _Alois P. Heinz_, Mar 14 2021 %t A342331 Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],And@@Table[#[[i]]==2*#[[i-1]]||#[[i-1]]==2*#[[i]],{i,2,Length[#]}]&]],{n,0,15}] %t A342331 (* Second program: *) %t A342331 b[n_, i_] := b[n, i] = If[n == 0, 1, Sum[b[n - j, j], {j, If[i == 0, Range[n], Select[{2i, i/2}, IntegerQ[#] && # <= n &]]}]]; %t A342331 a[n_] := b[n, 0]; %t A342331 a /@ Range[0, 80] (* _Jean-François Alcover_, May 09 2021, after _Alois P. Heinz_ *) %o A342331 (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*3<=k, M[i*2,k-i]))); concat([1], sum(q=1, n, M[q, ]))} \\ _Andrew Howroyd_, Mar 13 2021 %Y A342331 The unordered version (partitions) is A154402. %Y A342331 The version allowing equality is A342340. %Y A342331 A000929 counts partitions with all adjacent parts x >= 2y. %Y A342331 A002843 counts compositions with all adjacent parts x <= 2y. %Y A342331 A224957 counts compositions with all x <= 2y and y <= 2x (strict: A342342). %Y A342331 A274199 counts compositions with all adjacent parts x < 2y. %Y A342331 A342094 counts partitions with all adjacent x <= 2y (strict: A342095). %Y A342331 A342096 counts partitions with no adjacent x >= 2y (strict: A342097). %Y A342331 A342098 counts partitions with all adjacent parts x > 2y. %Y A342331 A342330 counts compositions with all x < 2y and y < 2x (strict: A342341). %Y A342331 A342332 counts compositions with all adjacent parts x > 2y or y > 2x. %Y A342331 A342333 counts compositions with adjacent parts x >= 2y or y >= 2x. %Y A342331 A342335 counts compositions with all adjacent parts x >= 2y or y = 2x. %Y A342331 A342337 counts partitions with all adjacent parts x = y or x = 2y. %Y A342331 A342338 counts compositions with all adjacent parts x < 2y and y <= 2x. %Y A342331 Cf. A003114, A003242, A167606, A342083, A342084, A342087, A342191, A342334, A342336, A342339. %K A342331 nonn %O A342331 0,4 %A A342331 _Gus Wiseman_, Mar 09 2021 %E A342331 More terms from _Joerg Arndt_, Mar 12 2021 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE