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

A097152
Smallest prime p greater than n for which n is a quadratic residue mod p.
2
7, 11, 5, 11, 19, 19, 17, 11, 13, 19, 13, 17, 31, 17, 17, 19, 23, 31, 29, 37, 29, 29, 29, 29, 37, 37, 29, 53, 37, 41, 41, 37, 37, 43, 37, 41, 43, 41, 41, 43, 47, 53, 53, 59, 53, 53, 59, 53, 71, 59, 53, 59, 67, 67, 61, 59, 61, 67, 61, 73, 67, 83, 67, 67, 97, 73, 83, 73, 73, 73
OFFSET
2,1
LINKS
Eric Weisstein's World of Mathematics, Quadratic Residue.
MATHEMATICA
f[n_] := Block[{k = PrimePi[n]}, While[ JacobiSymbol[ n, Prime[k]] != 1, k++ ]; Prime[ k]]; Table[ f[n], {n, 2, 60}]
PROG
(PARI) a(n) = forprime(p = n + 1, oo, if(issquare(Mod(n, p)), return(p))) \\ Peter Schorn, May 13 2020
CROSSREFS
Cf. A097143.
Sequence in context: A050081 A144076 A113492 * A212769 A269485 A228954
KEYWORD
nonn,easy
AUTHOR
Robert G. Wilson v, Jul 27 2004
STATUS
approved