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.

Original entry on oeis.org

5, 7, 13, 13, 2129401, 62198641, 62198641, 62198641, 28641897012961, 5193520377811921, 64090546658938801
Offset: 1

Views

Author

Marc Morgenegg, Aug 06 2025

Keywords

Comments

All terms are the larger member of a twin prime pair, since for k=1 (p-1-1)/1=p-2 must be prime.

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.
		

Crossrefs

Subsequence of A006512.
Cf. A089531.

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