login
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.
1
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,12
EXAMPLE
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;
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 *)
PROG
(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=', ')
CROSSREFS
Cf. A007318 - Pascal's triangle read by rows.
Sequence in context: A162246 A277447 A333698 * A118400 A159853 A087698
KEYWORD
nonn,tabl
AUTHOR
Alex Ratushnyak, Jun 06 2012
EXTENSIONS
Offset corrected by Joerg Arndt, Dec 05 2016
STATUS
approved