cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A342331 Number of compositions of n where each part after the first is either twice or half the prior part.

Original entry on oeis.org

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, 157, 114, 85, 264, 187, 147, 428, 315, 244, 732, 527, 410, 1207, 892, 681, 2034, 1490, 1155, 3416, 2508, 1927, 5731, 4215, 3259, 9597, 7091, 5454, 16175, 11914, 9194, 27134, 20033, 15425, 45649, 33672, 25967, 76714
Offset: 0

Views

Author

Gus Wiseman, Mar 09 2021

Keywords

Comments

All quotients of adjacent parts are either 1/2 or 2.

Examples

			The a(1) =  1 through a(12) = 14 compositions (A = 10, B = 11, C = 12):
  1  2  3   4    5    6     7      8      9       A        B        C
        12  121  212  24    124    242    36      424      21242    48
        21            42    421    21212  63      12124    24212    84
                      1212  12121         1242    12421    2121212  363
                      2121                2124    42121             2424
                                          2421    1212121           4242
                                          4212                      121242
                                          121212                    124212
                                          212121                    212124
                                                                    212421
                                                                    242121
                                                                    421212
                                                                    12121212
                                                                    21212121
		

Crossrefs

The unordered version (partitions) is A154402.
The version allowing equality is A342340.
A000929 counts partitions with all adjacent parts x >= 2y.
A002843 counts compositions with all adjacent parts x <= 2y.
A224957 counts compositions with all x <= 2y and y <= 2x (strict: A342342).
A274199 counts compositions with all adjacent parts x < 2y.
A342094 counts partitions with all adjacent x <= 2y (strict: A342095).
A342096 counts partitions with no adjacent x >= 2y (strict: A342097).
A342098 counts partitions with all adjacent parts x > 2y.
A342330 counts compositions with all x < 2y and y < 2x (strict: A342341).
A342332 counts compositions with all adjacent parts x > 2y or y > 2x.
A342333 counts compositions with adjacent parts x >= 2y or y >= 2x.
A342335 counts compositions with all adjacent parts x >= 2y or y = 2x.
A342337 counts partitions with all adjacent parts x = y or x = 2y.
A342338 counts compositions with all adjacent parts x < 2y and y <= 2x.

Programs

  • Maple
    b:= proc(n, i) option remember; `if`(n=0, 1, add(b(n-j, j), j=
         `if`(i=0, 1..n, select(t-> t::integer and t<=n, {2*i, i/2}))))
        end:
    a:= n-> b(n, 0):
    seq(a(n), n=0..80);  # Alois P. Heinz, Mar 14 2021
  • Mathematica
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],And@@Table[#[[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[{2i, i/2}, IntegerQ[#] && # <= n &]]}]];
    a[n_] := b[n, 0];
    a /@ Range[0, 80] (* Jean-François Alcover, May 09 2021, after Alois P. Heinz *)
  • 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

Extensions

More terms from Joerg Arndt, Mar 12 2021