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

A058043
a(n) = nextprime(n^2) - prevprime(n^2).
11
2, 4, 4, 6, 6, 6, 6, 4, 4, 14, 10, 6, 4, 4, 6, 10, 14, 8, 4, 4, 8, 18, 6, 12, 4, 6, 14, 14, 20, 14, 10, 4, 10, 6, 6, 6, 8, 12, 4, 24, 18, 14, 16, 10, 16, 6, 12, 12, 26, 16, 8, 16, 8, 14, 16, 22, 10, 22, 14, 8, 14, 22, 6, 10, 8, 10, 16, 24, 14, 12, 10, 10, 6, 16, 30, 12, 10, 18, 24, 10
OFFSET
2,1
LINKS
EXAMPLE
6^2=36 is immediately preceded and followed by 31 and 37, of which 6 is the difference.
MAPLE
[seq(nextprime(i^2)-prevprime(i^2), i=2..1000)];
MATHEMATICA
Table[n2=n^2; (NextPrime[n2]-NextPrime[n2, -1]), {n, 2, 100}] (* Vladimir Joseph Stephan Orlovsky, Mar 09 2011 *)
PROG
(PARI) A058043(n) = nextprime(n^2)-prime(primepi(n^2)) \\ Michael B. Porter, Feb 09 2010
CROSSREFS
Sequence in context: A058249 A340226 A348769 * A251546 A282894 A162550
KEYWORD
nonn
AUTHOR
Labos Elemer, Nov 17 2000
STATUS
approved