|
|
A307263
|
|
Primes p with a record number of iterations of the map p -> p - pi(p) until a nonprime is being reached.
|
|
0
|
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
|
|
LINKS
|
|
|
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
|
|
|
KEYWORD
|
nonn,more
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|