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.

A373748 Triangle read by rows: T(n, k) is k if k is a quadratic residue modulo n, otherwise is -k and is a quadratic nonresidue modulo n. T(0, 0) = 0 by convention.

This page as a plain text file.
%I A373748 #25 Jun 29 2024 12:30:28
%S A373748 0,0,1,0,1,2,0,1,-2,3,0,1,-2,-3,4,0,1,-2,-3,4,5,0,1,-2,3,4,-5,6,0,1,2,
%T A373748 -3,4,-5,-6,7,0,1,-2,-3,4,-5,-6,-7,8,0,1,-2,-3,4,-5,-6,7,-8,9,0,1,-2,
%U A373748 -3,4,5,6,-7,-8,9,10,0,1,-2,3,4,5,-6,-7,-8,9,-10,11,0,1,-2,-3,4,-5,-6,-7,-8,9,-10,-11,12
%N A373748 Triangle read by rows: T(n, k) is k if k is a quadratic residue modulo n, otherwise is -k and is a quadratic nonresidue modulo n. T(0, 0) = 0 by convention.
%H A373748 Carl Friedrich Gauss, <a href="http://gdz.sub.uni-goettingen.de/dms/load/img/?PID=PPN373456743%7CLOG_0008">Vierter Abschnitt. Von den Congruenzen zweiten Grades. Quadratische Reste und Nichtreste. Art. 97</a>, in "Untersuchungen über die höhere Arithmetik", Hrsg. H. Maser, Verlag von Julius Springer, Berlin, 1889.
%H A373748 Peter Luschny, <a href="/A373748/a373748.txt">SageMath: is_quadratic_residue</a>.
%e A373748 Triangle starts:
%e A373748   [0] [0]
%e A373748   [1] [0,  1]
%e A373748   [2] [0,  1,  2]
%e A373748   [3] [0,  1, -2,  3]
%e A373748   [4] [0,  1, -2, -3,  4]
%e A373748   [5] [0,  1, -2, -3,  4,  5]
%e A373748   [6] [0,  1, -2,  3,  4, -5,  6]
%e A373748   [7] [0,  1,  2, -3,  4, -5, -6,  7]
%e A373748   [8] [0,  1, -2, -3,  4, -5, -6, -7,  8]
%e A373748   [9] [0,  1, -2, -3,  4, -5, -6,  7, -8,  9]
%e A373748  [10] [0,  1, -2, -3,  4,  5,  6, -7, -8,  9,  10]
%p A373748 QR := (a, n) -> ifelse(n = 0, 1, NumberTheory:-QuadraticResidue(a, n)):
%p A373748 for n from 0 to 10 do seq(a*QR(a, n), a = 0..n) od;
%t A373748 qr[n_] := qr[n] = Join[Table[PowerMod[k, 2, n], {k, 0, Floor[n/2]}], {n}];
%t A373748 T[0, 0] := 0; T[n_, k_] := If[MemberQ[qr[n], k], k, -k];
%t A373748 Table[T[n, k], {n, 0, 11}, {k, 0, n}] // Flatten
%o A373748 (SageMath)
%o A373748 def Trow(n):
%o A373748     q = set(mod(a * a, n) for a in range(n // 2  + 1)).union({n})
%o A373748     return [k if k in q else -k for k in range(n + 1)]
%o A373748 for n in range(11): print(Trow(n))
%Y A373748 Signed version of A002262.
%Y A373748 Cf. A000004 (column 0), A001477 (main diagonal), A255644(n) + n (row sums).
%Y A373748 Cf. A096008, A096013, A373749.
%K A373748 sign,tabl
%O A373748 0,6
%A A373748 _Peter Luschny_, Jun 27 2024