OFFSET
0,18
COMMENTS
The definition of the binary operation MOD in the name follows CMath (Graham et al.) and Bach & Shallit. This is important because some CAS unfortunately do not follow this definition and throw a 'division by zero' error if n = 0.
Row n reduced to a set is the set of the quadratic residues mod n.
REFERENCES
Eric Bach and Jeffrey Shallit, Algorithmic Number Theory, p. 21.
R. L. Graham, D. E. Knuth and O. Patashnik, Concrete Mathematics, Addison-Wesley, 2nd ed., pp. 81f.
EXAMPLE
Triangle starts:
[0] 0;
[1] 0, 0;
[2] 0, 1, 0;
[3] 0, 1, 1, 0;
[4] 0, 1, 0, 1, 0;
[5] 0, 1, 4, 4, 1, 0;
[6] 0, 1, 4, 3, 4, 1, 0;
[7] 0, 1, 4, 2, 2, 4, 1, 0;
[8] 0, 1, 4, 1, 0, 1, 4, 1, 0;
[9] 0, 1, 4, 0, 7, 7, 0, 4, 1, 0;
[10] 0, 1, 4, 9, 6, 5, 6, 9, 4, 1, 0;
MAPLE
REM := (n, k) -> ifelse(k = 0, n, irem(n, k)):
T := n -> local k; seq(REM(k^2, n), k = 0..n):
seq(T(n), n = 0..12);
MATHEMATICA
MOD[n_, k_] := If[k == 0, n, Mod[n, k]];
Table[MOD[k^2, n], {n, 0, 10}, {k, 0, n}]
PROG
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Peter Luschny, Jun 23 2024
STATUS
approved
