login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A089750 a(n) = the first prime in the orbit of n under f(n) = n + the first prime > n, or 0 if no such prime exists. 1
3, 2, 3, 43, 5, 13, 7, 19, 43, 379, 11, 113, 13, 31, 18749, 2341, 17, 37, 19, 43, 379, 788941, 23, 53, 113, 241, 511213, 4089763, 29, 61, 31, 18749, 2341, 71, 601, 73, 37, 79, 163, 331, 41, 353, 43, 379, 788941, 403941973, 47, 101, 13499, 103, 211 (list; graph; refs; listen; history; text; internal format)
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

Sequence in context: A248244 A139170 A139075 * A109591 A143932 A304496

Adjacent sequences:  A089747 A089748 A089749 * A089751 A089752 A089753

KEYWORD

nonn

AUTHOR

Joseph L. Pe, Jan 08 2004

EXTENSIONS

More terms from Michel Marcus, May 19 2013

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 23 01:32 EDT 2020. Contains 337291 sequences. (Running on oeis4.)