A356741 a(n) is the least prime(m) such that prime(n) + prime(m)# is prime, where prime(m)# denotes the product of the first m primes, or -1 if no such prime(m) exists.
2, 2, 3, 2, 3, 2, 7, 3, 2, 3, 3, 2, 5, 3, 3, 2, 3, 3, 2, 3, 5, 3, 11, 3, 2, 3, 2, 5, 11, 5, 3, 2, 7, 2, 3, 3, 5, 3, 3, 2, 5, 2, 3, 2, 5, 5, 3, 2, 7, 3, 2, 5, 3, 3, 3, 2, 3, 3, 2, 5, 7, 3, 2, 7, 5, 3, 5, 2, 5, 3, 5, 3, 3, 5, 3, 5, 7, 5, 5, 2, 7, 2, 3, 11, 3, 5, 3
Offset: 2
Keywords
Examples
For n=4, prime(4)=7, and m=1 gives prime(m)=2 and prime(n) + prime(m)# = 7 + 2 = 9 (nonprime), but m=2 gives prime(m)=3 and prime(n) + prime(m)# = 7 + 2*3 = 13 (prime), so a(4) = prime(2) = 3.
Links
- Alain Rocchelli, Table of n, a(n) for n = 2..10000
Programs
-
PARI
a(n) = my(p=2, pr=2, pn=prime(n)); while (!isprime(pn+pr), p=nextprime(p+1); pr *= p); p; \\ Michel Marcus, Sep 05 2022
-
Python
from sympy import isprime, nextprime, prime def a(n): pn, pm, pmsharp = prime(n), 2, 2 while not isprime(pn + pmsharp): pm = nextprime(pm); pmsharp *= pm return pm print([a(n) for n in range(2, 89)]) # Michael S. Branicky, Sep 04 2022
Formula
a(n) = prime(A100380(n)). - Michel Marcus, Sep 12 2022
Comments