cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A386873 Smallest prime p such that (p-k-1)/k is also prime for all k=1..n.

This page as a plain text file.
%I A386873 #34 Aug 20 2025 18:56:08
%S A386873 5,7,13,13,2129401,62198641,62198641,62198641,28641897012961,
%T A386873 5193520377811921,64090546658938801
%N A386873 Smallest prime p such that (p-k-1)/k is also prime for all k=1..n.
%C A386873 All terms are the larger member of a twin prime pair, since for k=1 (p-1-1)/1=p-2 must be prime.
%H A386873 Marc Morgenegg, <a href="/A386873/a386873.txt">Python Program</a>
%F A386873 a(n) == 1 mod lcm(1,2,...,n). - _Chai Wah Wu_, Aug 20 2025
%e A386873 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.
%o A386873 (Python)
%o A386873 from itertools import islice
%o A386873 from gmpy2 import is_prime, next_prime
%o A386873 def agen(): # generator of terms
%o A386873     n = p = 1
%o A386873     while True:
%o A386873         k, p = 1, next_prime(p); q, r = p - 2, 0
%o A386873         while r == 0 and is_prime(q): k += 1; q, r = divmod(p - k - 1, k)
%o A386873         while n < k: n += 1; yield int(p)
%o A386873 print(list(islice(agen(), 8))) # _Michael S. Branicky_, Aug 14 2025
%o A386873 (Python)
%o A386873 from itertools import count
%o A386873 from math import lcm
%o A386873 from sympy import isprime
%o A386873 def A386873(n):
%o A386873     m = lcm(*range(1,n+1))
%o A386873     for i in count(m+1,m):
%o A386873         if isprime(i) and all(isprime((i-1)//j-1) for j in range(1,n+1)):
%o A386873             return i # _Chai Wah Wu_, Aug 20 2025
%Y A386873 Subsequence of A006512.
%Y A386873 Cf. A089531.
%K A386873 nonn,more,new
%O A386873 1,1
%A A386873 _Marc Morgenegg_, Aug 06 2025
%E A386873 a(9)-a(11) from _Jinyuan Wang_, Aug 15 2025