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.
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
Keywords
Examples
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.
Programs
-
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
Extensions
More terms from Michel Marcus, Nov 16 2021
Comments