OFFSET
1,5
COMMENTS
If n-th prime q is of the form 4k + 1, then by quadratic reciprocity row n consists of quadratic residues mod q, that are less than 2k; i.e., for q > 3, the first half of the corresponding row in A063987.
The first term in each row is always 1.
EXAMPLE
The 1st prime, 2, not of the form 4k + 1, is a square modulo odd primes p if and only if p = +/- 1 (mod 4*2 = 8).
The 6th prime, 13, of the form 4k + 1, is a square modulo odd primes p if and only if p = +/- 1, +/- 3, or +/- 4 (mod 13).
The irregular triangle T(n,k) begins (q is prime(n)):
n q \k 1 2 3 4 5 6 7 8 9 10 11
1, 2: 1
2, 3: 1
3, 5: 1
4, 7: 1 3 9
5, 11: 1 5 7 9 19
6: 13: 1 3 4
7, 17: 1 2 4 8
8, 19: 1 3 5 9 15 17 25 27 31
9, 23: 1 7 9 11 13 15 19 25 29 41 43
10, 29: 1 4 5 6 7 9 13
PROG
(Python)
from sympy import prime
def A371497_row(n):
q = prime(n)
res = {i*i % q for i in range(1, q//2 + 1)}
if q % 4 == 1:
res = {a for a in res if 2*a < q}
else:
res = {((a % 4 - 1) * q + a) % (4*q) for a in res}
res = {a if a < 2*q else 4*q - a for a in res}
return sorted(res)
CROSSREFS
KEYWORD
nonn,tabf,easy
AUTHOR
Nick Hobson, Mar 25 2024
STATUS
approved