login
A007920
Smallest number k such that n + k is prime.
14
2, 1, 0, 0, 1, 0, 1, 0, 3, 2, 1, 0, 1, 0, 3, 2, 1, 0, 1, 0, 3, 2, 1, 0, 5, 4, 3, 2, 1, 0, 1, 0, 5, 4, 3, 2, 1, 0, 3, 2, 1, 0, 1, 0, 3, 2, 1, 0, 5, 4, 3, 2, 1, 0, 5, 4, 3, 2, 1, 0, 1, 0, 5, 4, 3, 2, 1, 0, 3, 2, 1, 0, 1, 0, 5, 4, 3, 2, 1, 0, 3, 2, 1, 0, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 3, 2, 1, 0, 1, 0, 3, 2, 1, 0, 1
OFFSET
0,1
COMMENTS
a(n) = A007918(n) - n.
LINKS
M. Popescu, V. Seleacu, About the Smarandache Complementary Prime Function, Smarandache Notions Journal, Vol. 7, No. 1-2-3, 1996, 12-22.
F. Smarandache, Only Problems, Not Solutions!, via viXra.
EXAMPLE
a(22) = 1 because 22 + 1 = 23, the next higher prime.
a(23) = 0 because 23 is prime.
a(24) = 5 because 24 + 5 = 29, the next higher prime.
a(25) = 4 because 25 + 4 = 29, the next higher prime.
MATHEMATICA
distToPrime[n_] := If[PrimeQ[n], 0, NextPrime[n] - n]; Array[distToPrime, 110, 0] (* Harvey P. Dale, Sep 19 2011 *)
PROG
(PARI) a(n)=nextprime(n)-n
CROSSREFS
Cf. A064722, A013632 (a slightly different version).
Sequence in context: A246398 A051699 A328682 * A127587 A175832 A330961
KEYWORD
nonn,easy
AUTHOR
R. Muller
EXTENSIONS
More terms from Joanna S. Bartlett (s1117611(AT)cedarville.edu)
STATUS
approved