OFFSET
2,2
COMMENTS
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.
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).
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.
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}.
FORMULA
As a table array with offset 1, T(n, k) = (n*k) % (n+k). - Michel Marcus, Nov 28 2019
EXAMPLE
Triangle starts:
1;
2, 2;
3, 0, 3;
4, 1, 1, 4;
5, 2, 3, 2, 5;
6, 3, 5, 5, 3, 6;
PROG
(JavaScript)
function cNumber(x, y) {
return [x, y];
}
function cMult(a, b) {
return [a[0]*b[0]-a[1]*b[1], a[0]*b[1]+a[1]*b[0]];
}
for (i=1; i<20; i++)
for (j=1; j<i; j++) {
ij=cNumber(i, j);
ij2=cMult(ij, ij);
ijm=ij2[0]%ij[0];
document.write(ijm+", ");
}
(PARI) T(n, k) = real((n+k*I)^2) % n;
tabl(nn) = for(n=2, nn, for(k=1, n-1, print1(T(n, k), ", "); ); print(); ) \\ Michel Marcus, Jun 25 2018
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Jon Perry, Dec 13 2013
EXTENSIONS
Edited by Jon E. Schoenfield, Jun 30 2018
STATUS
approved