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

%I #25 Jun 29 2024 12:30:28

%S 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 -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 -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 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 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 Peter Luschny, <a href="/A373748/a373748.txt">SageMath: is_quadratic_residue</a>.

%e Triangle starts:

%e [0] [0]

%e [1] [0, 1]

%e [2] [0, 1, 2]

%e [3] [0, 1, -2, 3]

%e [4] [0, 1, -2, -3, 4]

%e [5] [0, 1, -2, -3, 4, 5]

%e [6] [0, 1, -2, 3, 4, -5, 6]

%e [7] [0, 1, 2, -3, 4, -5, -6, 7]

%e [8] [0, 1, -2, -3, 4, -5, -6, -7, 8]

%e [9] [0, 1, -2, -3, 4, -5, -6, 7, -8, 9]

%e [10] [0, 1, -2, -3, 4, 5, 6, -7, -8, 9, 10]

%p QR := (a, n) -> ifelse(n = 0, 1, NumberTheory:-QuadraticResidue(a, n)):

%p for n from 0 to 10 do seq(a*QR(a, n), a = 0..n) od;

%t qr[n_] := qr[n] = Join[Table[PowerMod[k, 2, n], {k, 0, Floor[n/2]}], {n}];

%t T[0, 0] := 0; T[n_, k_] := If[MemberQ[qr[n], k], k, -k];

%t Table[T[n, k], {n, 0, 11}, {k, 0, n}] // Flatten

%o (SageMath)

%o def Trow(n):

%o q = set(mod(a * a, n) for a in range(n // 2 + 1)).union({n})

%o return [k if k in q else -k for k in range(n + 1)]

%o for n in range(11): print(Trow(n))

%Y Signed version of A002262.

%Y Cf. A000004 (column 0), A001477 (main diagonal), A255644(n) + n (row sums).

%Y Cf. A096008, A096013, A373749.

%K sign,tabl

%O 0,6

%A _Peter Luschny_, Jun 27 2024

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 10:26 EDT 2024. Contains 374969 sequences. (Running on oeis4.)