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.

A213126 Rows of triangle formed using Pascal's rule, except sums in the n-th row are modulo n: T(n,0) = T(n,n) = 1 and T(n,k) = (T(n-1,k-1) + T(n-1,k)) mod n.

Original entry on oeis.org

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

Views

Author

Alex Ratushnyak, Jun 06 2012

Keywords

Examples

			Triangle begins:
  1;
  1,  1;
  1,  0,  1;
  1,  1,  1,  1;
  1,  2,  2,  2,  1;
  1,  3,  4,  4,  3,  1;
  1,  4,  1,  2,  1,  4,  1;
  1,  5,  5,  3,  3,  5,  5,  1;
  1,  6,  2,  0,  6,  0,  2,  6,  1;
  1,  7,  8,  2,  6,  6,  2,  8,  7,  1;
  1,  8,  5,  0,  8,  2,  8,  0,  5,  8,  1;
  1,  9,  2,  5,  8, 10, 10,  8,  5,  2,  9,  1;
		

Crossrefs

Cf. A007318 - Pascal's triangle read by rows.

Programs

  • Mathematica
    T[n_,k_]:=If[k==0 || k==n, 1, Mod[T[n - 1, k - 1] + T[n- 1, k], n]]; Table[T[n, k], {n, 0, 15}, {k, 0, n}] // Flatten (* Indranil Ghosh, Apr 29 2017 *)
  • Python
    src = [0]*1024
    dst = [0]*1024
    for n in range(19):
        dst[0] = dst[n] = 1
        for k in range(1, n):
            dst[k] = (src[k-1]+src[k]) % n
        for k in range(n+1):
            src[k] = dst[k]
            print(dst[k], end=',')

Extensions

Offset corrected by Joerg Arndt, Dec 05 2016