login
A348424
a(n) is the difference between the index of the prime p = A035345(n)-A002110(n) and n, or 0 if the difference is composite.
0
1, 1, 1, 1, 2, 4, 1, 1, 1, 3, 8, 8, 6, 7, 1, 13, 1, 1, 11, 5, 7, 1, 14, 22, 2, 2, 25, 21, 3, 19, 13, 7, 18, 84, 18, 2, 3, 48, 14, 7, 3, 5, 34, 8, 89, 20, 91, 64, 17, 27, 12, 35, 15, 8, 5, 3, 23, 6, 9, 16, 34, 6, 2, 15, 3, 6, 15, 15, 85, 32, 151, 17, 16, 1, 8, 5, 102, 22, 17, 35, 49
OFFSET
0,5
COMMENTS
The sequence relates to the number of iterations to reach the primes of A035345 (0 if composite) from the terms of A002110. The mechanism evaluates primality of P# + prime offset, where offset begins above the largest prime factor, increasing until a prime is encountered. The first term (n=0) is just the trivial case of 2 added to A002110(0)=1, producing prime=3. Adjacent primes are not treated by the mechanism.
Considering the primorials to length 2000 digits, the average and maximum iteration respectively are approximately 149 and 1707. As might be expected, both values increase as larger primorials are considered. However, the 303rd term = 3 for example, so it is sometimes possible to produce primes of a desired size within a few iterations.
Conjecture 1: The mechanism always returns a prime in a finite number of iterations (term always exists). So the sequence would be infinite.
Conjecture 2: Terms will always be less than the associated offset (so for n=33, the base primorial is 72047817630210000485677936198920432067383702541010310, with largest pf=137. The entry of 84 is less than 137.
EXAMPLE
A002110(7) = 510510 whose next prime is 510529. 510529 - 510510 = 19 which is the 8th prime, so a(7) = 8 - 7 = 1.
A002110(9) = 223092870 = 2*3*5*7*11*13*17*19*23. We evaluate 223092870 + 29, 223092870 + 31 then 223092870 + 37 is prime, so a(9) = 3.
PROG
(GAP)
# GAP 4.11.1
mySeq:= [];; ptr:=1;; prodd:=1;; while ptr<169 do tcnt:=0;; prodd:=prodd*Primes[ptr];; z:= Primes[ptr];; repeat tcnt:=tcnt+1;; z:= NextPrimeInt(z);; until IsPrime (prodd+z); Add(mySeq, tcnt); ptr:=ptr+1;; od; Print(mySeq);
(PARI) P(n) = prod(i=1, n, prime(i)); \\ A002110
Q(n) = nextprime(P(n)+2); \\ A035345
a(n) = my(x=Q(n)-P(n)); if (isprime(x), primepi(x) - n, 0); \\ Michel Marcus, Nov 15 2021
CROSSREFS
Sequence in context: A276631 A059817 A099803 * A247645 A177196 A010741
KEYWORD
nonn
AUTHOR
Bill McEachen, Nov 04 2021
EXTENSIONS
More terms from Michel Marcus, Nov 16 2021
STATUS
approved