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.

A136157 Triangle by columns, (3, 1, 0, 0, 0, ...) in every column.

Original entry on oeis.org

3, 1, 3, 0, 1, 3, 0, 0, 1, 3, 0, 0, 0, 1, 3, 0, 0, 0, 0, 1, 3, 0, 0, 0, 0, 0, 1, 3, 0, 0, 0, 0, 0, 0, 1, 3, 0, 0, 0, 0, 0, 0, 0, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3
Offset: 0

Views

Author

Gary W. Adamson, Dec 16 2007

Keywords

Comments

Infinite lower triangular matrix with (3, 3, 3, ...) in the main diagonal and (1, 1, 1, ...) in the subdiagonal, with the rest zeros.

Examples

			First few rows of the triangle:
  3;
  1, 3;
  0, 1, 3;
  0, 0, 1, 3;
  0, 0, 0, 1, 3;
  0, 0, 0, 0, 1, 3;
  ...
		

Crossrefs

Cf. A136158.

Programs

  • Magma
    function T(n,k) // T = A136157
      if k gt n-2 then return 2 + (-1)^(n+k);
      else return 0;
      end if;
    end function;
    [T(n,k): k in [0..n], n in [0..12]]; // G. C. Greubel, Dec 26 2023
    
  • Mathematica
    Table[PadLeft[{1,3},n,{0}],{n,0,20}]//Flatten (* Harvey P. Dale, Apr 04 2018 *)
  • SageMath
    def T(n,k): # T = A136157
        if k>n-2: return 2 + (-1)^(n+k)
        else: return 0
    flatten([[T(n,k) for k in range(n+1)] for n in range(13)]) # G. C. Greubel, Dec 26 2023

Formula

From G. C. Greubel, Dec 26 2023: (Start)
T(n, k) = 3 if k = n, T(n, k) = 1 if k = n-1, otherwise T(n, k) = 0.
T(n, k) = 2 + (-1)^(n+k) for k >= n-1, otherwise T(n, k) = 0.
Sum_{k=0..n} T(n, k) = 4 - [n=0].
Sum_{k=0..n} (-1)^k*T(n, k) = (-2)^n + [n=0].
Sum_{k=0..floor(n/2)} T(n-k, k) = 2 + (-1)^n.
Sum_{k=0..floor(n/2)} (-1)^k*T(n-k, k) = (2 + (-1)^n)*(-1)^floor(n/2). (End)

Extensions

Offset changed by G. C. Greubel, Dec 26 2023