login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A373088
a(n) = min{k : KroneckerSymbol(n, k) = -1} if n is not a square, 0 otherwise.
3
0, 0, 3, 2, 0, 2, 7, 5, 3, 0, 7, 2, 5, 2, 3, 13, 0, 3, 5, 2, 3, 2, 5, 3, 7, 0, 3, 2, 5, 2, 11, 7, 3, 5, 7, 2, 0, 2, 3, 11, 7, 3, 5, 2, 3, 2, 11, 3, 5, 0, 3, 2, 5, 2, 7, 7, 3, 5, 5, 2, 13, 2, 3, 5, 0, 3, 7, 2, 3, 2, 13, 3, 5, 5, 3, 2, 7, 2, 5, 11, 3, 0, 5, 2
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
Similar: A092419, A144294.
Cf. A372728.
Sequence in context: A277097 A077814 A131728 * A075115 A273528 A085080
KEYWORD
nonn
AUTHOR
Peter Luschny, May 26 2024
STATUS
approved