OFFSET
1,1
COMMENTS
Note that a(n) = n when n is prime.
Question: Is a(n) > 0 for all n? I do not have a value for a(46).
a(46)=403941973, a(52)=31626333786385669717. - Michel Marcus, May 19 2013
LINKS
Robert Israel, Table of n, a(n) for n = 1..2000
EXAMPLE
4 -> 4 + (first prime > 4) = 4 + 5 = 9 -> 9 + 11 = 20 -> 20 + 23 = 43 (prime). So a(4) = 43.
MAPLE
f:= proc(n) local k;
k:= n;
while not isprime(k) do k:= k + nextprime(k) od;
k
end proc:
map(f, [$1..100]); # Robert Israel, Sep 04 2018
MATHEMATICA
a[n_] := NestWhile[# + NextPrime[#]&, n, CompositeQ];
Array[a, 100] (* Jean-François Alcover, Aug 26 2020 *)
PROG
(PARI) a(n) = {while(! isprime(n), n = n + nextprime(n+1); ); return (n); } \\ Michel Marcus, May 19 2013
CROSSREFS
KEYWORD
nonn
AUTHOR
Joseph L. Pe, Jan 08 2004
EXTENSIONS
More terms from Michel Marcus, May 19 2013
STATUS
approved