[seqfan] Re: Definition of A166980, quadratic residues

franktaw at netscape.net franktaw at netscape.net
Mon Nov 2 14:33:37 CET 2009

Richard,

I think your second suggestion and program is the intended
interpretation, and the differences are errors.  I recommend that you
go ahead and edit it on that basis.

Here's a PARI program if you want to include that, too:

a(n)=local(p,q);q=p=prime(n);while(!issquare(Mod(p,q=nextprime(q+1))),0);
q

Neil,

I note that most of this author's sequences are either marked "uned" or
have been edited; the remainder mostly need editing.   I recommend that
he be added to the list of those whose sequences are automatically
marked "uned" if this has not already been done.

-----Original Message-----
From: Richard Mathar <mathar at strw.leidenuniv.nl>

I do not understand the construction of A166980
http://research.att.com/~njas/sequences/A166980
The definition, as I see it, is that "a(n) is the smallest prime q
which has a
...

When the definition is changed to "a(n) is the smallest prime >
prime(n) with
we have

A166980 := proc(n)
local p,q,i ;
p := ithprime(n) ;
for i from 1 do
q := ithprime(i) ;
if numtheory[legendre](p,q) = 1 and q>p then
return q;
end if;
od:
end proc;
seq(A166980(n),n=1..80) ;

and get

7, 11, 11, 19, 19, 17, 19, 31, 29, 53, 41, 41, 43, 53, 53, 59, 67, 73,
73, 73,
79, 89, 103, 97, 101, 107, 127, 127, 113, 127, 139, 139, 139, 151,
173,
163, 167, 173, 173, 179, 193, 193, 193, 197, 223, 211, 223, 241,
251, 233,
241, 241, 251, 283, 283, 269, 283, 281, 281, 283, 293, 307, 313,
313, 317,
353, 337, 349, 367, 353, 383, 389, 379, 383, 401, 389, 409, 401,
409, 419
which also differs from the current A166980.

Richard Mathar