OFFSET
1,1
COMMENTS
Take any n, find the distance from n to p: d=p-n, where p is the smallest prime > n ("next prime"), then a(n) is the number which is at the same distance from p as n, a(n)=p+d. n such that p+d=2p-n is prime in A087031.
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..1000
FORMULA
a(n)=2p-n, p is the smallest prime > n.
EXAMPLE
a(2)=4 because smallest prime >2 is 3 and 2*3-2=4.
MATHEMATICA
Table[2NextPrime[n]-n, {n, 80}] (* Harvey P. Dale, Jun 29 2011 *)
PROG
(PARI) a(n)=2*nextprime(n+1)-n \\ Charles R Greathouse IV, Oct 03 2013
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Zak Seidov, Jul 31 2003
STATUS
approved