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.

A048158 Triangular array T read by rows: T(n,k) = n mod k, for k=1,2,...,n, n=1,2,...

Original entry on oeis.org

0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 2, 1, 0, 0, 0, 0, 2, 1, 0, 0, 1, 1, 3, 2, 1, 0, 0, 0, 2, 0, 3, 2, 1, 0, 0, 1, 0, 1, 4, 3, 2, 1, 0, 0, 0, 1, 2, 0, 4, 3, 2, 1, 0, 0, 1, 2, 3, 1, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 2, 0, 5, 4, 3, 2, 1, 0, 0, 1, 1, 1, 3, 1, 6, 5, 4, 3, 2, 1, 0, 0, 0, 2, 2, 4, 2, 0, 6, 5, 4, 3, 2, 1, 0
Offset: 1

Views

Author

Keywords

Comments

Also, rectangular array read by antidiagonals: a(n, k) = n mod k, n >= 0, k >= 1. Cf. A051126, A051127, A051777. - David Wasserman, Oct 01 2008

Examples

			Triangle begins
  0;
  0  0;
  0  1  0;
  0  0  1  0;
  0  1  2  1  0;
  0  0  0  2  1  0;
  0  1  1  3  2  1  0;
  0  0  2  0  3  2  1  0;
  0  1  0  1  4  3  2  1  0;
  0  0  1  2  0  4  3  2  1  0;
  0  1  2  3  1  5  4  3  2  1  0;
  0  0  0  0  2  0  5  4  3  2  1  0;
  ...
From _Omar E. Pol_, Feb 21 2014: (Start)
Illustration of the 12th row of triangle:
-----------------------------------
.      k: 1 2 3 4 5 6 7 8 9 10..12
-----------------------------------
.         _ _ _ _ _ _ _ _ _ _ _ _
.        |_| | | | | | | | | | | |
.        |_|_| | | | | | | | | | |
.        |_| |_| | | | | | | | | |
.        |_|_| |_| | | | | | | | |
.        |_| | | |_| | | | | | | |
.        |_|_|_| | |_| | | | | | |
.        |_| | | | | |_| | | | | |
.        |_|_| |_| | |*|_| | | | |
.        |_| |_| | | |* *|_| | | |
.        |_|_| | |_| |* * *|_| | |
.        |_| | | |*| |* * * *|_| |
.        |_|_|_|_|*|_|* * * * *|_|
.
Row 12 is 0 0 0 0 2 0 5 4 3 2 1 0
(End)
		

Crossrefs

Row sums are given by A004125.
Cf. A002260.

Programs

  • Haskell
    a048158 = mod
    a048158_row n = a048158_tabl !! (n-1)
    a048158_tabl = zipWith (map . mod) [1..] a002260_tabl
    -- Reinhard Zumkeller, Apr 29 2015, Jan 20 2014 (fixed), Aug 13 2013
    
  • Maple
    T:= (n, k)-> modp(n, k):
    seq(seq(T(n, k), k=1..n), n=1..20); # Alois P. Heinz, Apr 04 2012
  • Mathematica
    Flatten[Table[Mod[n, Range[n]], {n, 15}]]
  • Python
    def A048158_T(n,k): return n%k # Chai Wah Wu, May 13 2024

Formula

A051731(n,k) = A000007(T(n,k)). - Reinhard Zumkeller, Nov 01 2009
T(n,k) = n - k*A010766(n,k). - Mats Granvik, Gary W. Adamson, Feb 20 2010
G.f. for the k-th column: x^(k+1)*Sum_{i=0..k-2} (i + 1)*x^i/(1 - x^k). - Stefano Spezia, May 08 2024

Extensions

More terms from David Wasserman, Oct 01 2008