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.

Showing 1-2 of 2 results.

A235684 Number of compositions of n into powers of 3 and doubled powers of 3.

Original entry on oeis.org

1, 1, 2, 4, 7, 13, 25, 46, 86, 162, 302, 565, 1058, 1978, 3700, 6923, 12949, 24223, 45316, 84769, 158575, 296645, 554923, 1038079, 1941911, 3632677, 6795551, 12712263, 23780486, 44485521, 83217888, 155673480, 291214232, 544766722, 1019080592, 1906366927
Offset: 0

Views

Author

Keywords

Comments

a(n+1)/a(n) tends to 1.87067337504749000600807516613083316430149226... (used Richardson's extrapolation) - Vaclav Kotesovec, Jan 14 2014

Examples

			a(3) = 4: 1+1+1, 2+1, 1+2, 3, thus we have 4 compositions with the allowed parts.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; `if`(n=0, 1, `if`(n<0, 0,
          add(a(n-3^i)+a(n-2*3^i), i=0..ilog[3](n))))
        end:
    seq(a(n), n=0..40);  # Alois P. Heinz, Jan 13 2014
  • Mathematica
    a[n_] := a[n] = If[n == 0, 1, If[n < 0, 0, Sum[a[n - 3^i] + a[n - 2*3^i], {i, 0, Log[3, n]}]]];
    a /@ Range[0, 40] (* Jean-François Alcover, Nov 07 2020, after Alois P. Heinz *)

A235773 Number of compositions of n into distinct powers of 3 and doubled powers of 3.

Original entry on oeis.org

1, 1, 1, 3, 2, 2, 7, 2, 2, 9, 8, 8, 32, 6, 6, 26, 6, 6, 31, 26, 26, 128, 6, 6, 26, 6, 6, 33, 32, 32, 158, 30, 30, 152, 30, 30, 176, 150, 150, 870, 24, 24, 126, 24, 24, 146, 126, 126, 750, 24, 24, 126, 24, 24, 151, 146, 146, 872, 126, 126, 770, 126, 126, 872
Offset: 0

Views

Author

Keywords

Examples

			Let n=5. We have only two allowed compositions 2+3 = 3+2. So a(5) = 2.
For n=6, we have compositions 6 = 1+2+3 = 1+3+2 = 2+3+1 = 2+1+3 = 3+2+1 = 3+1+2. Thus a(6) = 7.
		

Crossrefs

Programs

  • Maple
    b:= proc(n, i) option remember; `if`(n=0, 1, `if`(i<0, 0,
          expand(b(n, i-1)+`if`(3*3^i>n, 0, b(n-3*3^i, i-1)*x^2)
          +add(`if`(j*3^i>n, 0, b(n-j*3^i, i-1))*x, j=1..2))))
        end:
    a:= n->(p->add(coeff(p, x, j)*j!, j=0..degree(p)))(b(n, ilog[3](n))):
    seq(a(n), n=0..100);  # Alois P. Heinz, Jan 15 2014
  • Mathematica
    b[n_, i_] := b[n, i] = If[n==0, 1, If[i<0, 0, Expand[b[n, i-1] + If[3^(i+1) > n, 0, b[n-3^(i+1), i-1]x^2] + Sum[If[3^i j > n, 0, b[n-3^i j, i-1]]x, {j, 1, 2}]]]];
    a[n_] := With[{p = b[n, Log[3, n] // Floor]}, Sum[Coefficient[p, x, j] j!, {j, 0, Exponent[p, x]}]];
    a /@ Range[0, 100] (* Jean-François Alcover, Nov 12 2020, after Alois P. Heinz *)
Showing 1-2 of 2 results.