login
A372726
Legendre's triangle read by rows. T(n, k) = L(n / prime(k)) where L(n/p) is the Legendre symbol, for n >= 0 and 2 <= k <= n + 2.
7
0, 1, 1, -1, -1, 1, 0, -1, -1, 1, 1, 1, 1, 1, 1, -1, 0, -1, 1, -1, -1, 0, 1, -1, -1, -1, -1, 1, 1, -1, 0, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 0, -1, -1, 1, -1, -1, -1, 1, -1
OFFSET
0
LINKS
Paolo Xausa, Table of n, a(n) for n = 0..11475 (rows 0..150 of the triangle, flattened).
Adrien Marie Legendre, Essai sur la théorie des nombres, Paris, Duprat, an VI [1798]. Introducing the symbol, p. 186.
FORMULA
T(n, k) = r - p*[r > 1] where r = n^v mod p, p = prime(k), v = (p - 1)/2, and [.] are the Iverson brackets.
EXAMPLE
Triangle starts:
[ 0] 0;
[ 1] 1, 1;
[ 2] -1, -1, 1;
[ 3] 0, -1, -1, 1;
[ 4] 1, 1, 1, 1, 1;
[ 5] -1, 0, -1, 1, -1, -1;
[ 6] 0, 1, -1, -1, -1, -1, 1;
[ 7] 1, -1, 0, -1, -1, -1, 1, -1;
[ 8] -1, -1, 1, -1, -1, 1, -1, 1, -1;
[ 9] 0, 1, 1, 1, 1, 1, 1, 1, 1, 1;
[10] 1, 0, -1, -1, 1, -1, -1, -1, -1, 1, 1;
.
Not limiting the range of k leads to the square array:
.
[n\p] 3, 5, 7, 11, 13, 17, 19, 23, 29, 31
-----------------------------------------------
[0] 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[1] 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
[2] -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, ...
[3] 0, -1, -1, 1, 1, -1, -1, 1, -1, -1, ...
[4] 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
[5] -1, 0, -1, 1, -1, -1, 1, -1, 1, 1, ...
[6] 0, 1, -1, -1, -1, -1, 1, 1, 1, -1, ...
[7] 1, -1, 0, -1, -1, -1, 1, -1, 1, 1, ...
[8] -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, ...
[9] 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
...
MAPLE
L := (n, k) -> NumberTheory:-LegendreSymbol(n, ithprime(k)):
for n from 0 to 10 do lprint([n], seq(L(n, k), k = 2..n + 2)) od;
MATHEMATICA
Array[JacobiSymbol[#, Prime[Range[2, #+2]]]&, 15, 0] (* Paolo Xausa, Jul 09 2024 *)
PROG
(Python)
from sympy import primerange, prime, legendre_symbol
for n in range(11):
print([n], [legendre_symbol(n, p) for p in primerange(3, prime(n + 2) + 1)])
# For illustration of the formula (Sympy's implementation is more efficent):
def LegendreSymbol(n, p):
v = (p - 1) // 2
res = pow(n, v, p)
return res - p if res > 1 else res
CROSSREFS
Family: A217831 (Euclid's triangle), A372877 (Jacobi's triangle), A372728 (Kronecker's triangle), A373223 (Gauss' triangle), A373751 (quadratic residue modulo prime(n)), A373748 (quadratic residue/nonresidue modulo n).
Cf. A372725 (row sums).
Sequence in context: A182067 A196147 A097325 * A242647 A167393 A275606
KEYWORD
sign,tabl
AUTHOR
Peter Luschny, May 22 2024
EXTENSIONS
Data corrected by Paolo Xausa, Jul 09 2024
STATUS
approved