A386873 Smallest prime p such that (p-k-1)/k is also prime for all k=1..n.
5, 7, 13, 13, 2129401, 62198641, 62198641, 62198641, 28641897012961, 5193520377811921, 64090546658938801
Offset: 1
Examples
a(4) = 13 is the smallest prime p such that (p-k-1)/k is prime for all k=1..4. (13-2)/1=11, (13-3)/2=5, (13-4)/3=3, (13-5)/4=2.
Links
- Marc Morgenegg, Python Program
Programs
-
Python
from itertools import islice from gmpy2 import is_prime, next_prime def agen(): # generator of terms n = p = 1 while True: k, p = 1, next_prime(p); q, r = p - 2, 0 while r == 0 and is_prime(q): k += 1; q, r = divmod(p - k - 1, k) while n < k: n += 1; yield int(p) print(list(islice(agen(), 8))) # Michael S. Branicky, Aug 14 2025
-
Python
from itertools import count from math import lcm from sympy import isprime def A386873(n): m = lcm(*range(1,n+1)) for i in count(m+1,m): if isprime(i) and all(isprime((i-1)//j-1) for j in range(1,n+1)): return i # Chai Wah Wu, Aug 20 2025
Formula
a(n) == 1 mod lcm(1,2,...,n). - Chai Wah Wu, Aug 20 2025
Extensions
a(9)-a(11) from Jinyuan Wang, Aug 15 2025
Comments