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”).

a(n) = min{k : KroneckerSymbol(n, k) = -1} if n is not a square, 0 otherwise.
3

%I #9 May 31 2024 14:24:26

%S 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,

%T 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,

%U 7,2,3,2,13,3,5,5,3,2,7,2,5,11,3,0,5,2

%N a(n) = min{k : KroneckerSymbol(n, k) = -1} if n is not a square, 0 otherwise.

%F If n is not a square then a(n) is a prime number.

%p K := (n, k) -> NumberTheory:-KroneckerSymbol(n, k):

%p a := proc(n) if issqr(n) then return 0 fi;

%p local k; k := 0;

%p while true do

%p if K(n, k) = -1 then return k fi;

%p k := k + 1;

%p od; -1; end:

%p seq(a(n), n = 0..83);

%o (SageMath)

%o def A373088(n):

%o if is_square(n): return 0

%o k = 0

%o while True:

%o if kronecker_symbol(n, k) == -1:

%o return k

%o k += 1

%o return k

%o print([A373088(n) for n in range(83)])

%o (PARI) a(n) = if (issquare(n), 0, my(k=1); while (kronecker(n,k) != -1, k++); k); \\ _Michel Marcus_, May 31 2024

%Y Similar: A092419, A144294.

%Y Cf. A372728.

%K nonn

%O 0,3

%A _Peter Luschny_, May 26 2024