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.

Showing 1-5 of 5 results.

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

A051127 Table T(n,k) = k mod n read by antidiagonals (n >= 1, k >= 1).

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Note that the upper right half of this sequence when formatted as a square array is essentially the same as this whole sequence when formatted as an upper right triangle. Sums of antidiagonals are A004125. - Henry Bottomley, Jun 22 2001

Examples

			0  0  0  0  0  0  0  0  0  0 ...
1  0  1  0  1  0  1  0  1  0 ...
1  2  0  1  2  0  1  2  0  1 ...
1  2  3  0  1  2  3  0  1  2 ...
1  2  3  4  0  1  2  3  4  0 ...
1  2  3  4  5  0  1  2  3  4 ...
1  2  3  4  5  6  0  1  2  3 ...
1  2  3  4  5  6  7  0  1  2 ...
1  2  3  4  5  6  7  8  0  1 ...
1  2  3  4  5  6  7  8  9  0 ...
1  2  3  4  5  6  7  8  9 10 ...
1  2  3  4  5  6  7  8  9 10 ...
1  2  3  4  5  6  7  8  9 10 ...
		

Crossrefs

Transpose of A051126.

Programs

  • Mathematica
    T[n_, m_] = Mod[n - m + 1, m + 1]; Table[Table[T[n, m], {m, 0, n}], {n, 0, 10}]; Flatten[%] (* Roger L. Bagula, Sep 04 2008 *)
  • PARI
    T(n, k)=k%n \\ Charles R Greathouse IV, Feb 09 2017

Formula

As a linear array, the sequence is a(n) = A004736(n) mod A002260(n) or a(n) = ((t*t+3*t+4)/2-n) mod (n-(t*(t+1)/2)), where t = floor((-1+sqrt(8*n-7))/2). - Boris Putievskiy, Dec 17 2012
G.f. for the n-th row: y*Sum_{i=0..n-2} (i + 1)*y^i/(1 - y^n). - Stefano Spezia, May 08 2024

Extensions

More terms from James Sellers, Dec 11 1999

A051126 Table T(n,k) = n mod k read by downward antidiagonals (n >= 1, k >= 1).

Original entry on oeis.org

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

Views

Author

Keywords

Examples

			Table begins in row n=1:
  0  1  1  1  1  1  1  1  1  1 ...
  0  0  2  2  2  2  2  2  2  2 ...
  0  1  0  3  3  3  3  3  3  3 ...
  0  0  1  0  4  4  4  4  4  4 ...
  0  1  2  1  0  5  5  5  5  5 ...
  0  0  0  2  1  0  6  6  6  6 ...
  0  1  1  3  2  1  0  7  7  7 ...
  0  0  2  0  3  2  1  0  8  8 ...
  0  1  0  1  4  3  2  1  0  9 ...
  0  0  1  2  0  4  3  2  1  0 ...
  0  1  2  3  1  5  4  3  2  1 ...
  0  0  0  0  2  0  5  4  3  2 ...
  0  1  1  1  3  1  6  5  4  3 ...
		

Crossrefs

Programs

  • Mathematica
    TableForm[Table[Mod[n, k], {n, 1, 16}, {k, 1, 16}]] (* A051126 array *)
    Table[Mod[n - k + 1, k], {n, 16}, {k, n, 1, -1}] // Flatten  (* A051126 sequence *)
    (* Clark Kimberling, Feb 04 2016 *)

Formula

As a linear array, the sequence is a(n) = A002260(n) mod A004736 (n) or a(n) = (n-(t*(t+1)/2)) mod ((t*t+3*t+4)/2-n), where t = floor((-1+sqrt(8*n-7))/2). - Boris Putievskiy, Dec 19 2012
G.f. of the k-th column: x*Sum_{i=0..k-2} (i + 1)*x^i/(1 - x^k). - Stefano Spezia, May 08 2024

Extensions

More terms from James Sellers, Dec 11 1999

A051778 Triangle read by rows, where row (n) = n mod (n-1), n mod (n-2), n mod (n-3), ...n mod 2.

Original entry on oeis.org

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

Views

Author

Asher Auel, Dec 09 1999

Keywords

Comments

Central terms: a(2*n+1,n) = n for n > 0. - Reinhard Zumkeller, Dec 03 2014
Deleting column 1 of the array at A051126 gives the array A051778 in square format (see Example). - Clark Kimberling, Feb 04 2016

Examples

			row (7) = 7 mod 6, 7 mod 5, 7 mod 4, 7 mod 3, 7 mod 2 = 1, 2, 3, 1, 1.
1;
1  0 ;
1  2  1 ;
1  2  0  0 ;
1  2  3  1  1 ;
1  2  3  0  2  0 ;
1  2  3  4  1  0  1 ;
1  2  3  4  0  2  1  0 ;
1  2  3  4  5  1  3  2  1 ;
1  2  3  4  5  0  2  0  0  0 ;
1  2  3  4  5  6  1  3  1  1  1 ;
Northwest corner of square array:
1 1 1 1 1 1 1 1 1 1 1
0 2 2 2 2 2 2 2 2 2 2
1 0 3 3 3 3 3 3 3 3 3
0 1 0 4 4 4 4 4 4 4 4
1 2 1 0 5 5 5 5 5 5 5
0 0 2 1 0 6 6 6 6 6 6
1 1 3 2 1 0 7 7 7 7 7
- _Clark Kimberling_, Feb 04 2016
		

Crossrefs

Cf. A004125 (row sums), A000027 (central terms), A049820 (number of nonzeros per row), A032741 (number of ones per row), A070824 (number of zeros per row).

Programs

  • Haskell
    a051778 n k = a051778_tabl !! (n-3) !! (k-1)
    a051778_row n = a051778_tabl !! (n-3)
    a051778_tabl = map (\xs -> map (mod (head xs + 1)) xs) $
                       iterate (\xs -> (head xs + 1) : xs) [2]
    -- Reinhard Zumkeller, Dec 03 2014
  • Mathematica
    Flatten[Table[Mod[n,i],{n,3,20},{i,n-1,2,-1}]] (* Harvey P. Dale, Sep 09 2012 *)
    TableForm[Table[Mod[n, k], {n, 1, 12}, {k, 2, 12}]] (* square *)
    (* Clark Kimberling, Feb 04 2016 *)

A273619 Table read by antidiagonals (n>1, k>0): A(n,k) = leading digit of k in base n.

Original entry on oeis.org

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

Views

Author

Andrey Zabolotskiy, May 30 2016

Keywords

Comments

This is a generalization of A000030.
The first occurrence of a number k in the sequence is given by A(k+1,k).

Examples

			First few rows of the array are:
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1, 2, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2...
1, 2, 3, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 1, 1, 1...
1, 2, 3, 4, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3...
1, 2, 3, 4, 5, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3...
1, 2, 3, 4, 5, 6, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2...
1, 2, 3, 4, 5, 6, 7, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2...
Note that the initial row is row 2.
A(3,3) corresponds to row n=3 and column k=3, and k=3 is written as 10 in base n=3, and the leading digit of 10 is 1, so A(3,3)=1.
A(12,11) corresponds to row n=12 and column k=11, and 11 is written as B in base 12, and the leading and only digit of B is B which is number 11 in decimal, so A(12,11)=11.
		

Crossrefs

Cf. A000030 (row 10), A122586 (row 3), A122587 (row 4).
Cf. A051777, A051778 (may be interpreted as arrays of last digits of k in base n).

Programs

  • Maple
    A:= (n,k) -> floor(k/n^floor(log[n](k))):
    seq(seq(A(n-k,k),k=1..n-2),n=2..20); # Robert Israel, May 31 2016
  • Mathematica
    a[n_, k_] := First[IntegerDigits[k, n]];
  • PARI
    T(n,k) = digits(k, n)[1];
    tabl(10, 10, n, k, n++; T(n,k)); \\ Michel Marcus, Jun 12 2016

Formula

From Robert Israel, May 31 2016: (Start)
A(n,k) = floor(k/n^floor(log_n(k))).
A(n,k) = k if n > k.
A(n,k) = A(n, floor(k/n)) otherwise.
G.f. of row n, G_n(x), satisfies G_n(x) = (1-x^n)/(1-x)^2 - (1+(n-1)*x^n)/(1-x) + (1-x^n)*G_n(x^n)/(1-x). (End)
Showing 1-5 of 5 results.