

A166980


The smallest prime p larger than prime(n) such that prime(n) is a quadratic residue (mod p).


1



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
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,1


COMMENTS

Positions where a(n) = a(n+1) = a(n+2) = a(n+3) are for example n=737 and n=1262.  R. J. Mathar, Nov 17 2009


LINKS

Table of n, a(n) for n=1..59.


EXAMPLE

When n=4, prime(4) = 7, and a(4) is the smallest prime above 7 with quadratic residue 7.
This yields a(4)= 19 because 8^2 = 7 (mod 19) and 19 > 7. The intermediate candidates 11, 13 and 17 fail the test.


MAPLE

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


PROG

(PARI) A166980(n) = { local(q=prime(n), p=nextprime(q+1)) ; while( kronecker(q, p)!=1, p=nextprime(p+1) ; ) ; return(p) ; } { print(vector(80, n, A166980(n))); } /* R. J. Mathar, Nov 02 2009 */


CROSSREFS

Sequence in context: A134702 A053674 A205679 * A184071 A243885 A171017
Adjacent sequences: A166977 A166978 A166979 * A166981 A166982 A166983


KEYWORD

easy,nonn


AUTHOR

J. M. Bergot, Oct 26 2009


EXTENSIONS

Some values corrected and definition clarified by R. J. Mathar, Nov 02 2009


STATUS

approved



