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.
%I A373749 #14 Jun 24 2024 06:34:44 %S A373749 0,0,0,0,1,0,0,1,1,0,0,1,0,1,0,0,1,4,4,1,0,0,1,4,3,4,1,0,0,1,4,2,2,4, %T A373749 1,0,0,1,4,1,0,1,4,1,0,0,1,4,0,7,7,0,4,1,0,0,1,4,9,6,5,6,9,4,1,0,0,1, %U A373749 4,9,5,3,3,5,9,4,1,0,0,1,4,9,4,1,0,1,4,9,4,1,0 %N A373749 Triangle read by rows: T(n, k) = MOD(k^2, n) where MOD(a, n) = a if n = 0 and otherwise a - n*floor(a/n). (Quadratic residue.) %C A373749 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. %C A373749 Row n reduced to a set is the set of the quadratic residues mod n. %D A373749 Eric Bach and Jeffrey Shallit, Algorithmic Number Theory, p. 21. %D A373749 R. L. Graham, D. E. Knuth and O. Patashnik, Concrete Mathematics, Addison-Wesley, 2nd ed., pp. 81f. %e A373749 Triangle starts: %e A373749 [0] 0; %e A373749 [1] 0, 0; %e A373749 [2] 0, 1, 0; %e A373749 [3] 0, 1, 1, 0; %e A373749 [4] 0, 1, 0, 1, 0; %e A373749 [5] 0, 1, 4, 4, 1, 0; %e A373749 [6] 0, 1, 4, 3, 4, 1, 0; %e A373749 [7] 0, 1, 4, 2, 2, 4, 1, 0; %e A373749 [8] 0, 1, 4, 1, 0, 1, 4, 1, 0; %e A373749 [9] 0, 1, 4, 0, 7, 7, 0, 4, 1, 0; %e A373749 [10] 0, 1, 4, 9, 6, 5, 6, 9, 4, 1, 0; %p A373749 REM := (n, k) -> ifelse(k = 0, n, irem(n, k)): %p A373749 T := n -> local k; seq(REM(k^2, n), k = 0..n): %p A373749 seq(T(n), n = 0..12); %t A373749 MOD[n_, k_] := If[k == 0, n, Mod[n, k]]; %t A373749 Table[MOD[k^2, n], {n, 0, 10}, {k, 0, n}] %o A373749 (Julia) %o A373749 Mod(n, k) = k == 0 ? n : mod(n, k) %o A373749 T(n, k) = Mod(k^2, n) %o A373749 for n in 0:10 %o A373749 [T(n, k) for k in 0:n] |> println %o A373749 end %o A373749 (SageMath) %o A373749 def A373749(n, k): return mod(k^2, n) %o A373749 for n in range(11): print([A373749(n, k) for k in range(n + 1)]) %Y A373749 Variants: A048152, A096008. %Y A373749 Cf. A048153 (row sums), A373750 (middle terms). %K A373749 nonn,tabl %O A373749 0,18 %A A373749 _Peter Luschny_, Jun 23 2024