login
A371497
Irregular triangle read by rows: n-th row gives congruence classes s such that the n-th prime q is a quadratic residue modulo an odd prime p if and only if p = plus or minus s for some s (mod m), where m = q if q is of the form 4k + 1, else m = 4q.
0
1, 1, 1, 1, 3, 9, 1, 5, 7, 9, 19, 1, 3, 4, 1, 2, 4, 8, 1, 3, 5, 9, 15, 17, 25, 27, 31, 1, 7, 9, 11, 13, 15, 19, 25, 29, 41, 43, 1, 4, 5, 6, 7, 9, 13, 1, 3, 5, 9, 11, 15, 23, 25, 27, 33, 41, 43, 45, 49, 55, 1, 3, 4, 7, 9, 10, 11, 12, 16, 1, 2, 4, 5, 8, 9, 10, 16, 18, 20, 1, 3, 7, 9, 13, 17
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
Sequence in context: A355926 A019665 A119898 * A113847 A119796 A154572
KEYWORD
nonn,tabf,easy
AUTHOR
Nick Hobson, Mar 25 2024
STATUS
approved