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.

A158821 Triangle read by rows: row n (n>=0) ends with 1, and for n>=1 begins with n; other entries are zero.

Original entry on oeis.org

1, 1, 1, 2, 0, 1, 3, 0, 0, 1, 4, 0, 0, 0, 1, 5, 0, 0, 0, 0, 1, 6, 0, 0, 0, 0, 0, 1, 7, 0, 0, 0, 0, 0, 0, 1, 8, 0, 0, 0, 0, 0, 0, 0, 1, 9, 0, 0, 0, 0, 0, 0, 0, 0, 1, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
Offset: 0

Views

Author

Gary W. Adamson, Mar 30 2008

Keywords

Examples

			Triangle begins:
  1;
  1, 1;
  2, 0, 1;
  3, 0, 0, 1;
  4, 0, 0, 0, 1;
  5, 0, 0, 0, 0, 1;
  6, 0, 0, 0, 0, 0, 1;
  7, 0, 0, 0, 0, 0, 0, 1;
		

Crossrefs

Programs

  • Maple
    A158821:= proc(n,k)
        if n = k then 1;
        elif k = 0 then n;
        else 0;
        end if;
    end proc: # R. J. Mathar, Jan 08 2015
  • Mathematica
    T[n_, k_]:= If[k==0, Boole[n==0] +n, If[k==n, 1, 0]];
    Table[T[n, k], {n,0,12}, {k,0,n}]//Flatten (* G. C. Greubel, Dec 22 2021 *)
    Join[{1},Table[Join[{n},PadLeft[{1},n,0]],{n,15}]]//Flatten (* Harvey P. Dale, Apr 05 2023 *)
  • Sage
    def A158821(n,k):
        if (k==0): return n + bool(n==0)
        elif (k==n): return 1
        else: return 0
    flatten([[A158821(n,k) for k in (0..n)] for n in (0..12)]) # G. C. Greubel, Dec 22 2021

Formula

T(n, k) = A145677(n, n-k-1). - R. J. Mathar, Apr 01 2009
From G. C. Greubel, Dec 22 2021: (Start)
Sum_{k=0..n} T(n, k) = A000027(n).
Sum_{k=0..floor(n/2)} T(n-k, k) = A109613(n). (End)