%I #28 Sep 07 2018 11:31:19
%S 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,
%T 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,
%U 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
%N Smallest number k such that n + k is prime.
%C a(n) = A007918(n) - n.
%H T. D. Noe, <a href="/A007920/b007920.txt">Table of n, a(n) for n = 0..10000</a>
%H M. Popescu, V. Seleacu, <a href="http://doi.org/10.5281/zenodo.9582">About the Smarandache Complementary Prime Function</a>, Smarandache Notions Journal, Vol. 7, No. 1-2-3, 1996, 12-22.
%H F. Smarandache, <a href="http://vixra.org/abs/1005.0049">Only Problems, Not Solutions!</a>, via viXra.
%e a(22) = 1 because 22 + 1 = 23, the next higher prime.
%e a(23) = 0 because 23 is prime.
%e a(24) = 5 because 24 + 5 = 29, the next higher prime.
%e a(25) = 4 because 25 + 4 = 29, the next higher prime.
%t distToPrime[n_] := If[PrimeQ[n], 0, NextPrime[n] - n]; Array[distToPrime, 110, 0] (* _Harvey P. Dale_, Sep 19 2011 *)
%o (PARI) a(n)=nextprime(n)-n
%Y Cf. A064722, A013632 (a slightly different version).
%K nonn,easy
%O 0,1
%A R. Muller
%E More terms from Joanna S. Bartlett (s1117611(AT)cedarville.edu)