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.

A143182 Triangle T(n,m) = 1 + abs(n-2*m), read by rows, 0<=m<=n.

Original entry on oeis.org

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

Views

Author

Roger L. Bagula and Gary W. Adamson, Oct 17 2008

Keywords

Comments

From Boris Putievskiy, Jan 15 2013: (Start)
General case see A187760. Let m be natural number. Table T(n,k) n, k > 0, T(n,k)=n-k+1, if n>=k, T(n,k)=k-n+m-1, if n < k. Table T(n,k) read by antidiagonals. The first column of the table T(n,1) is the sequence of the natural numbers A000027. In all columns with number k (k > 1) the segment with the length of (k-1): {m+k-2, m+k-3, ..., m} shifts the sequence A000027. For m=1 the result is A220073, for m=2 the result is A143182. (End)

Examples

			From _Boris Putievskiy_, Jan 15 2013: (Start)
The start of the sequence as table:
1...2...3...4...5...6...7...8...9..10..11...
2...1...2...3...4...5...6...7...8...9..10...
3...2...1...2...3...4...5...6...7...8...9...
4...3...2...1...2...3...4...5...6...7...8...
5...4...3...2...1...2...3...4...5...6...7...
6...5...4...3...2...1...2...3...4...5...6...
7...6...5...4...3...2...1...2...3...4...5...
8...7...6...5...4...3...2...1...2...3...4...
9...8...7...6...5...4...3...2...1...2...3...
10..9...8...7...6...5...4...3...2...1...2...
11.10...9...8...7...6...5...4...3...2...1...
. . .
The start of the sequence as triangle array read by rows: (End)
   1;
   2, 2;
   3, 1, 3;
   4, 2, 2, 4;
   5, 3, 1, 3, 5;
   6, 4, 2, 2, 4, 6;
   7, 5, 3, 1, 3, 5, 7;
   8, 6, 4, 2, 2, 4, 6, 8;
   9, 7, 5, 3, 1, 3, 5, 7, 9;
  10, 8, 6, 4, 2, 2, 4, 6, 8, 10;
  11, 9, 7, 5, 3, 1, 3, 5, 7,  9, 11;
. . .
Row number r contains r numbers: r, r-2,...3,1,3,...r-2,r if r is odd,
r, r-2,...2,2,...r-2,r, if r is even. - _Boris Putievskiy_, Jan 15 2013
		

Crossrefs

Cf. A049581 (subtract 1's), A074148 (row sums), A000027, A220073, A187760.

Programs

  • GAP
    Flat(List([0..15], n-> List([0..n], k-> 1+AbsInt(n-2*k) ))); # G. C. Greubel, Jul 23 2019
  • Magma
    [1+Abs(n-2*k): k in [0..n], n in [0..15]]; // G. C. Greubel, Jul 23 2019
    
  • Mathematica
    T[n_, m_]:= 1+Abs[(1+n-m) - (1+m)]; Table[Table[t[n, m], {m,0,n}], {n, 0, 15}]//Flatten
  • PARI
    for(n=0,15, for(k=0,n, print1(1+abs(n-2*k), ", "))) \\ G. C. Greubel, Jul 23 2019
    
  • Sage
    [[1+abs(n-2*k) for k in (0..n)] for n in (0..15)] # G. C. Greubel, Jul 23 2019
    

Formula

Symmetry: T(n,m) = T(n,n-m).
From Boris Putievskiy, Jan 15 2013: (Start)
For the general case
a(n) = |(t+1)^2 - 2n| + m*floor((t^2+3t+2-2n)/(t+1)),
where t = floor((-1+sqrt(8*n-7))/2).
For m = 2
a(n) = |(t+1)^2 - 2n| + 2*floor((t^2+3t+2-2n)/(t+1)),
where t=floor((-1+sqrt(8*n-7))/2). (End)

Extensions

Offset and row sums corrected by R. J. Mathar, Jul 05 2012