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.

A101037 Triangle read by rows: T(n,1) = T(n,n) = n and for 1

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Nov 27 2004

Keywords

Comments

For n>1: sum of n-th row = A007590(n+1).

Examples

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

Programs

  • Maple
    T:= proc(n,k) if k < (n+1)/2 then n-2*k+2 elif k=(n+1)/2 then 2 else 2*k-n fi end proc:
    T(1,1):= 1:
    seq(seq(T(n,k),k=1..n),n=1..20); # Robert Israel, Jan 30 2018
  • Mathematica
    T[n_, 1] := n; T[n_, n_] := n; T[n_, k_] := T[n, k] = Which[k < (n + 1)/2, n - 2*k + 2, k == (n + 1)/2, 2, True, 2*k - n];
    Table[T[n, k], {n, 1, 13}, {k, 1, n}] // Flatten (* Jean-François Alcover, Mar 04 2019 *)

Formula

From Robert Israel, Jan 30 2018: (Start)
T(n,k) = n - 2*k + 2 if k < (n+1)/2.
T(n,(n+1)/2) = 2 if n>1 is odd.
T(n,k) = 2*k - n if k > (n+1)/2.
G.f. as triangle: x*y*(x^6*y^3-2*x^5*y^3-2*x^5*y^2+x^4*y^3+3*x^4*y^2+x^4*y-3*x^2*y+1)/((1-x^2*y)*(1-x)^2*(1-x*y)^2).
(End)