login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A307263
Primes p with a record number of iterations of the map p -> p - pi(p) until a nonprime is being reached.
0
2, 5, 13, 43, 61, 14897, 377942237, 75697732547
OFFSET
1,1
COMMENTS
a(9) > 1.7*10^11. - Giovanni Resta, Jul 07 2019
EXAMPLE
5 is in the sequence because if you start the algorithm from every prime < 5, you obtain a number of primes less than starting from 5. In fact, starting from 5, which is the 3rd prime number, you have (5-pi(5))=2, which is prime, then (2-pi(2))=1, which is not prime and so the algorithm stops. So applying the algorithm from 5 you have two prime numbers, 5 and 2. If you start the algorithm from any other prime < 5, then you have only one prime.
MATHEMATICA
f[p_] := Module[{c = 0, q = p}, While[PrimeQ[q], q -= PrimePi[q]; c++]; c]; fm = 0; s = {}; Do[f1 = f[n]; If[f1 > fm, fm = f1; AppendTo[s, n]], {n, 1, 15000}]; s (* Amiram Eldar, Jul 06 2019 *)
PROG
(PARI) maxi=0; forprime(q=1, 10^8, p=q; r=0; while(isprime(p)==1, r=r+1; s=primepi(p); p=p-s); if(r>maxi, maxi=r; print1(q, ", ")))
CROSSREFS
Sequence in context: A229161 A192745 A299430 * A278171 A212824 A338660
KEYWORD
nonn,more
AUTHOR
Paolo Galliani, Apr 01 2019
EXTENSIONS
a(8) from Giovanni Resta, Jul 07 2019
STATUS
approved