OFFSET
0,3
COMMENTS
The Kronecker symbol only takes the values -1, 0, and 1. One can ask about the first appearance of these values in the rows of the square array K(n, k) with n, k >= 2, and supplement for boundary values n, k = 0, 1. Answers can be found in A373088 (case -1), A020639 (case 0), and in this sequence (case 1).
MAPLE
K := (n, k) -> NumberTheory:-KroneckerSymbol(n, k):
a := proc(n) if n < 2 then return 1 - n fi;
local k; k := 2;
while true do
if K(n, k) = 1 then return k fi;
k := k + 1;
od; -1; end:
seq(a(n), n = 0..86);
PROG
(SageMath)
def A373180(n):
if n < 2: return 1 - n
k = 2
while True:
if kronecker_symbol(n, k) == 1:
return k
k += 1
return -1
print([A373180(n) for n in range(87)])
(PARI) a(n) = if (n < 2, 1 - n, my(k=2); while(kronecker(n, k)!=1, k++); k); \\ Michel Marcus, May 27 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Peter Luschny, May 27 2024
STATUS
approved