Svoboda | Graniru | BBC Russia | Golosameriki | Facebook
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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. 5
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, -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, -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 (list; table; graph; refs; listen; history; text; internal format)
OFFSET
0,6
LINKS
Carl Friedrich Gauss, Vierter Abschnitt. Von den Congruenzen zweiten Grades. Quadratische Reste und Nichtreste. Art. 97, in "Untersuchungen über die höhere Arithmetik", Hrsg. H. Maser, Verlag von Julius Springer, Berlin, 1889.
EXAMPLE
Triangle starts:
[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, 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, -3, 4, -5, -6, 7, -8, 9]
[10] [0, 1, -2, -3, 4, 5, 6, -7, -8, 9, 10]
MAPLE
QR := (a, n) -> ifelse(n = 0, 1, NumberTheory:-QuadraticResidue(a, n)):
for n from 0 to 10 do seq(a*QR(a, n), a = 0..n) od;
MATHEMATICA
qr[n_] := qr[n] = Join[Table[PowerMod[k, 2, n], {k, 0, Floor[n/2]}], {n}];
T[0, 0] := 0; T[n_, k_] := If[MemberQ[qr[n], k], k, -k];
Table[T[n, k], {n, 0, 11}, {k, 0, n}] // Flatten
PROG
(SageMath)
def Trow(n):
q = set(mod(a * a, n) for a in range(n // 2 + 1)).union({n})
return [k if k in q else -k for k in range(n + 1)]
for n in range(11): print(Trow(n))
CROSSREFS
Signed version of A002262.
Cf. A000004 (column 0), A001477 (main diagonal), A255644(n) + n (row sums).
Sequence in context: A166352 A025690 A025668 * A048151 A025675 A025682
KEYWORD
sign,tabl
AUTHOR
Peter Luschny, Jun 27 2024
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 6 07:30 EDT 2024. Contains 374960 sequences. (Running on oeis4.)