OFFSET
2,1
COMMENTS
The unproved conjecture that 2n - g(n) > 0 would imply Legendre's conjecture, since the next prime after max {p < n^2} will always occur before (n+1)^2.
FORMULA
a(n) = 2*n - A058043(n). - R. J. Mathar, Jul 13 2009
MAPLE
with(numtheory): A162417:=n->2*n-(ithprime(pi(n^2)+1)-ithprime(pi(n^2))): seq(A162417(n), n=2..100); # Wesley Ivan Hurt, Aug 01 2015
MATHEMATICA
Table[2i - (Prime[PrimePi[i^2]+1]-Prime[PrimePi[i^2]]), {i, 2, 1000}]
f[n_] := 2 n - Prime[PrimePi[n^2] + 1] + Prime[PrimePi[n^2]]; Table[ f@n, {n, 2, 69}] (* Robert G. Wilson v, Aug 17 2009 *)
PROG
(Magma) [2*n-(NthPrime(#PrimesUpTo(n^2)+1)-NthPrime(#PrimesUpTo(n^2))): n in [2..100]]; // Vincenzo Librandi, Aug 02 2015
CROSSREFS
KEYWORD
nonn
AUTHOR
Daniel Tisdale, Jul 02 2009
EXTENSIONS
Edited by N. J. A. Sloane, Jul 05 2009
Offset corrected by R. J. Mathar, Jul 13 2009
a(18) and further terms from Robert G. Wilson v, Aug 17 2009
STATUS
approved