A382785 a(n) is the least multiple of the n-th primorial such that both a(n)-1 and a(n)+1 are prime and the prime factors of a(n) do not exceed prime(n).
4, 6, 30, 420, 2310, 180180, 4084080, 106696590, 892371480, 103515091680, 4412330782860, 29682952539240, 22514519501013540, 313986271960080720, 22750921955774182170, 912496437361321252440, 26918644902158976946980, 1290172194953476680815970, 1901713815361424627522739780
Offset: 1
Keywords
Examples
For a(2), (2*3)*1 = 6 and the first twin primes are 5, 7. For a(3), (2*3*5)*1 = 30 and the first twin primes are 29, 31. For a(4), (2*3*5*7)*2 = 420, the first twin primes are 419, 421 and 2 <= prime(4). For a(5), (2*3*5*7*11)*1 = 2310 and the first twin primes are 3209, 3211. For a(6), (2*3*5*7*11*13)*2*3 = 180180. the first twin primes are 180179, 180181 and 2, 3 <= prime(6).
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..348
Programs
-
Mathematica
a[n_] := Module[{P,k},P=Product[Prime[i],{i, 1, n}];k = 1; While[!(PrimeQ[k*P-1] && PrimeQ[k*P+1]), k++];k*P] (* James C. McMahon, May 09 2025 *)
-
PARI
isok(k, p) = if (k>1, vecmax(factor(k)[,1])<=p, 1); a(n) = my(P=vecprod(primes(n)), k=1, p=prime(n)); while(!(isok(k, p) && ispseudoprime(k*P-1) && ispseudoprime(k*P+1)), k++); k*P; \\ Michel Marcus, Apr 27 2025
-
Python
from itertools import count from sympy import factorint, isprime, prime, primorial def a(n): pn, prn = prime(n), primorial(n) return next(k for m in count(1) if max(factorint(m), default=1)<=pn and isprime((k:=m*prn)-1) and isprime(k+1)) print([a(n) for n in range(1, 20)]) # Michael S. Branicky, Apr 18 2025
Extensions
Data corrected by Michael S. Branicky, Apr 18 2025
Comments