login
a(n) is the least number k that is a quadratic residue modulo prime(n) but is a quadratic nonresidue modulo all previous odd primes.
0

%I #18 Oct 20 2024 13:45:21

%S 0,5,2,38,17,83,362,167,227,2273,398,5297,64382,69467,116387,238262,

%T 214037,430022,5472953,9481097,8062073,41941577,86374763,312521282

%N a(n) is the least number k that is a quadratic residue modulo prime(n) but is a quadratic nonresidue modulo all previous odd primes.

%e a(5) = 38 because 38 is a quadratic residue modulo prime(5) = 11 but is not a quadratic residue modulo the previous odd primes 3, 5 and 7, and no number smaller than 38 works.

%p f:= proc(n) local k,p;

%p p:= 2;

%p for k from 2 do

%p p:= nextprime(p);

%p if numtheory:-quadres(n,p) = 1 then return k fi

%p od

%p end proc:

%p V:= Array(2..25): count:= 0:

%p for k from 2 while count < 24 do

%p v:= f(k);

%p if v > 0 and v <= 25 and V[v] = 0 then

%p V[v]:= k; count:= count+1;

%p fi;

%p od:

%p V[2]:= 0:

%p convert(V,list);

%Y Cf. A377212.

%K nonn

%O 2,2

%A _Robert Israel_, Oct 20 2024