Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #20 Nov 28 2019 06:15:15
%S 1,2,2,3,0,3,4,1,1,4,5,2,3,2,5,6,3,5,5,3,6,7,4,7,0,7,4,7,8,5,0,2,2,0,
%T 5,8,9,6,1,4,5,4,1,6,9,10,7,2,6,8,8,6,2,7,10,11,8,3,8,11,0,11,8,3,8,
%U 11,12,9,4,10,1,3,3,1,10,4,9,12,13,10,5,12,3,6,7,6,3,12,5,10,13,14,11,6,14,5,9,11,11,9,5,14
%N Triangle read by rows: T(n,k) = real part mod n of (n + ki)^2, where k=1..n-1 and i is the imaginary unit.
%C For prime n, if n == 1 (mod 4), sequence gives quadratic residues of n, and if n == 3 (mod 4) the sequence gives non-quadratic residues.
%C Check: The sixth row, the row for 7 (of the form 4k+3): {6, 3, 5, 5, 3, 6} contains only quadratic non-residues (3, 5 and 6).
%C Also, on the tenth row, for 11 (of the form 4k+3 also) it is also true: {10, 7, 2, 6, 8, 8, 6, 2, 7, 10}, as 2, 6, 7, 8 and 10 are exactly the quadratic non-residues of 11.
%C Also, on the twelfth row, for n=13 (of the form 4k+1), it is true that all its quadratic residues are listed: {12, 9, 4, 10, 1, 3, 3, 1, 10, 4, 9, 12}.
%F As a table array with offset 1, T(n, k) = (n*k) % (n+k). - _Michel Marcus_, Nov 28 2019
%e Triangle starts:
%e 1;
%e 2, 2;
%e 3, 0, 3;
%e 4, 1, 1, 4;
%e 5, 2, 3, 2, 5;
%e 6, 3, 5, 5, 3, 6;
%o (JavaScript)
%o function cNumber(x,y) {
%o return [x,y];
%o }
%o function cMult(a,b) {
%o return [a[0]*b[0]-a[1]*b[1],a[0]*b[1]+a[1]*b[0]];
%o }
%o for (i=1;i<20;i++)
%o for (j=1;j<i;j++) {
%o ij=cNumber(i,j);
%o ij2=cMult(ij,ij);
%o ijm=ij2[0]%ij[0];
%o document.write(ijm+", ");
%o }
%o (PARI) T(n,k) = real((n+k*I)^2) % n;
%o tabl(nn) = for(n=2, nn, for(k=1, n-1, print1(T(n,k), ", ");); print();) \\ _Michel Marcus_, Jun 25 2018
%K nonn,tabl
%O 2,2
%A _Jon Perry_, Dec 13 2013
%E Edited by _Jon E. Schoenfield_, Jun 30 2018