A056927 Difference between n^2 and largest prime less than n^2.
1, 2, 3, 2, 5, 2, 3, 2, 3, 8, 5, 2, 3, 2, 5, 6, 7, 2, 3, 2, 5, 6, 5, 6, 3, 2, 11, 2, 13, 8, 3, 2, 3, 2, 5, 2, 5, 10, 3, 12, 5, 2, 3, 8, 3, 2, 7, 2, 23, 8, 5, 6, 7, 2, 15, 20, 3, 12, 7, 2, 11, 2, 3, 6, 7, 6, 3, 2, 11, 2, 5, 6, 5, 2, 27, 2, 5, 12, 3, 8, 5, 6, 13, 6, 3, 8, 3, 2, 7, 8, 3, 2, 5, 12, 7, 6, 3
Offset: 2
Examples
a(4)=3 because largest prime less than 4^2 is 13 and 16-13=3.
Links
- T. D. Noe, Table of n, a(n) for n=2..10000
Programs
-
Maple
A056927 := n-> n^2-prevprime(n^2); seq(A056927(n), n=2..100);
-
Mathematica
Table[n2=n^2;n2-NextPrime[n2,-1],{n,2,100}] (* Vladimir Joseph Stephan Orlovsky, Mar 09 2011 *)
-
PARI
{my(maxx=10000);n=2;ptr=2;while(n<=maxx,q=n^2;pp=precprime(q); diff=q-pp;print(ptr," ",diff);n++;ptr++ );} \\ Bill McEachen, May 07 2014
Extensions
More terms from James Sellers, Jul 13 2000
Comments