OFFSET
2,1
COMMENTS
Conjecture: The number of terms in this sequence is infinite.
The number of occurrences of odd prime x is A014085((x-1)/2). - Robert Israel, Jun 08 2016
LINKS
Robert Israel, Table of n, a(n) for n = 2..10001
FORMULA
Let p be a prime number and r = floor(sqrt(p)). Then the closest surrounding squares of p are r^2 and (r+1)^2. So d = (r+1)^2 - r^2 = 2r+1. If d is prime then list d.
EXAMPLE
29 is a prime number. 5^2 and 6^2 are the closest squares surrounding 29. Now the difference, 36-25 = 11 is prime so 11 is in the table.
MAPLE
g:= proc(q) local x; x:= (q-1)/2; numtheory:-pi((x+1)^2) - numtheory:-pi(x^2) end proc:
seq(p$g(p), p = select(isprime, [seq(i, i=3..1000, 2)])); # Robert Israel, Jun 08 2016
MATHEMATICA
Select[Table[Ceiling[#]^2 - Floor[#]^2 &@ Sqrt@ Prime@ n, {n, 120}], PrimeQ] (* Michael De Vlieger, Jun 10 2016 *)
PROG
(PARI) surrsqpr(n) = { local(x, y, j, r, d); forprime(x=2, n, r=floor(sqrt(x)); d=r+r+1; if(isprime(d), print1(d", ") ) ) }
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Cino Hilliard, Nov 12 2005
STATUS
approved