OFFSET
0,3
FORMULA
If n is not a square then a(n) is a prime number.
MAPLE
K := (n, k) -> NumberTheory:-KroneckerSymbol(n, k):
a := proc(n) if issqr(n) then return 0 fi;
local k; k := 0;
while true do
if K(n, k) = -1 then return k fi;
k := k + 1;
od; -1; end:
seq(a(n), n = 0..83);
PROG
(SageMath)
def A373088(n):
if is_square(n): return 0
k = 0
while True:
if kronecker_symbol(n, k) == -1:
return k
k += 1
return k
print([A373088(n) for n in range(83)])
(PARI) a(n) = if (issquare(n), 0, my(k=1); while (kronecker(n, k) != -1, k++); k); \\ Michel Marcus, May 31 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Peter Luschny, May 26 2024
STATUS
approved