OFFSET
0
COMMENTS
Normally J(n, k) is only defined for odd k. Here, J(n, k) is 0 if and only if k is not prime to n or k is even. If k is an odd prime, J(n, k) is equal to the Legendre symbol L(n, k). If k is odd, J(n, k) is equal to the Kronecker symbol K(n, k). If n is a square residue mod k then J(n, k) = 1; but conversely it does not follow from J(n, k) = 1 that n is a square residue mod k.
LINKS
Carl Gustav Jacob Jacobi, Über die Kreistheilung und ihre Anwendung auf die Zahlentheorie, Bericht Akad. d. Wiss. zu Berlin 1837. Reprinted in Journal für die reine und angewandte Mathematik 30 (1846): 166-182.
EXAMPLE
Triangle J(n, k) starts:
[0] 0;
[1] 0, 1;
[2] 0, 1, 0;
[3] 0, 1, 0, 0;
[4] 0, 1, 0, 1, 0;
[5] 0, 1, 0, -1, 0, 0;
[6] 0, 1, 0, 0, 0, 1, 0;
[7] 0, 1, 0, 1, 0, -1, 0, 0;
[8] 0, 1, 0, -1, 0, -1, 0, 1, 0;
[9] 0, 1, 0, 0, 0, 1, 0, 1, 0, 0;
.
Not limiting the range of k leads to the square array:
[0] 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, ...
[1] 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, ...
[2] 0, 1, 0, -1, 0, -1, 0, 1, 0, 1, ...
[3] 0, 1, 0, 0, 0, -1, 0, -1, 0, 0, ...
[4] 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, ...
[5] 0, 1, 0, -1, 0, 0, 0, -1, 0, 1, ...
[6] 0, 1, 0, 0, 0, 1, 0, -1, 0, 0, ...
[7] 0, 1, 0, 1, 0, -1, 0, 0, 0, 1, ...
[8] 0, 1, 0, -1, 0, -1, 0, 1, 0, 1, ...
[9] 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, ...
...
MAPLE
J := (n, k) -> ifelse(k::even, 0, NumberTheory:-JacobiSymbol(n, k)):
seq(seq(J(n, k), k = 0..n), n = 0..12);
MATHEMATICA
Table[If[EvenQ[k], 0, JacobiSymbol[n, k]], {n, 0, 12}, {k, 0, n}] // Flatten
PROG
(Python) # This Jacobi symbol is also defined for even k and n = 0.
def JacobiSymbol(n, k):
if n == 0 and k == 1: return 1
if n == 0 or k % 2 == 0: return 0
n %= k
res = 1
while n != 0:
while n % 2 == 0:
n //= 2
if k % 8 in (3, 5): res = -res
if n % 4 == 3 == k % 4: res = -res
n, k = k % n, n
return res if k == 1 else 0
for n in range(10): print([JacobiSymbol(n, k) for k in range(n + 1)])
CROSSREFS
KEYWORD
sign,tabl
AUTHOR
Peter Luschny, May 18 2024
STATUS
approved