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) is the first positive number k such that k is alternately a quadratic residue and nonresidue modulo the first n primes, but not the n+1'th.
0

%I #11 Oct 27 2024 10:46:30

%S 1,2,11,41,26,5,671,89,59,1181,1991,3755,21521,34145,25994,137885,

%T 61106,1503029,2617439,1008551,2897081,22363295,33603926,36518450,

%U 79865294,185914490,593068985,2211452939,2120224529,1673286179,2644173521,1976870465

%N a(n) is the first positive number k such that k is alternately a quadratic residue and nonresidue modulo the first n primes, but not the n+1'th.

%C a(n) == 2 (mod 3) for n >= 2.

%e a(3) = 11 because 11 is a quadratic residue mod 2, a nonresidue mod 3, a residue mod 5, but a residue mod 7, and no smaller number works.

%p with(numtheory):

%p N:= 20:

%p V:= Vector(N): V[1]:= 1: count:= 1:

%p for x from 2 by 3 while count < N do

%p p:= 1:

%p for m from 0 do

%p p:= nextprime(p);

%p if numtheory:-quadres(x,p) <> (-1)^m then break fi;

%p od;

%p if V[m] = 0 then

%p V[m]:= x; count:= count+1;

%p fi

%p od:

%p convert(V,list);

%Y Cf. A096636, A377212.

%K nonn

%O 1,2

%A _Robert Israel_, Oct 27 2024