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.

A291878 Triangle read by rows: T(n,k) = number of fountains of n coins and height k.

Original entry on oeis.org

1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 2, 0, 1, 4, 0, 1, 7, 1, 0, 1, 12, 2, 0, 1, 20, 5, 0, 1, 33, 11, 0, 1, 54, 22, 1, 0, 1, 88, 44, 2, 0, 1, 143, 85, 5, 0, 1, 232, 161, 12, 0, 1, 376, 302, 25, 0, 1, 609, 559, 52, 1, 0, 1, 986, 1026, 105, 2, 0, 1, 1596, 1870, 207, 5, 0, 1
Offset: 0

Views

Author

Seiichi Manyama, Sep 05 2017

Keywords

Comments

Same as A187080, with trailing zeros omitted.

Examples

			T(6, 1) = 1;
. O O O O O O .
-------------------------------------------------------
T(6, 2) = 7;
.. O O ......... O O ..... O . O ..
. O O O O ... O O O O ... O O O O .
.......................................................
.. O ............. O ............. O ............. O ..
. O O O O O ... O O O O O ... O O O O O ... O O O O O .
-------------------------------------------------------
T(6, 3) = 1;
... O ...
.. O O ..
. O O O .
-------------------------------------------------------
First few rows are:
  1;
  0,  1;
  0,  1;
  0,  1,   1;
  0,  1,   2;
  0,  1,   4;
  0,  1,   7,   1;
  0,  1,  12,   2;
  0,  1,  20,   5;
  0,  1,  33,  11;
  0,  1,  54,  22,  1;
  0,  1,  88,  44,  2;
		

Crossrefs

Row sums give A005169.
Columns 0-2 give A000007, A000012, A000071.

Programs

  • Maple
    b:= proc(n, i, h) option remember; `if`(n=0, x^h,
          add(b(n-j, j, max(h, j)), j=1..min(i+1, n)))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, 0$2)):
    seq(T(n), n=0..30);  # Alois P. Heinz, Sep 05 2017
  • Mathematica
    b[n_, i_, h_] := b[n, i, h] = If[n == 0, x^h, Sum[b[n - j, j, Max[h, j]], {j, 1, Min[i + 1, n]}]];
    T[n_] := Table[Coefficient[#, x, i], {i, 0, Exponent[#, x]}]& @ b[n, 0, 0];
    Table[T[n], {n, 0, 30}] // Flatten (* Jean-François Alcover, May 31 2019, after Alois P. Heinz *)
  • Python
    from sympy.core.cache import cacheit
    from sympy import Symbol, Poly, flatten
    x=Symbol('x')
    @cacheit
    def b(n, i, h): return x**h if n==0 else sum([b(n - j, j, max(h, j)) for j in range(1, min(i + 1, n) + 1)])
    def T(n): return 1 if n==0 else Poly(b(n, 0, 0)).all_coeffs()[::-1]
    print(flatten(map(T, range(31)))) # Indranil Ghosh, Sep 06 2017