login
A370517
a(n) is the largest prime p such that all prime numbers q <= p have distinct length n prime gap sequences.
0
3, 7, 7, 7, 47, 251, 421, 421, 9769, 9769, 36469, 36469, 36469, 184224493, 2159263321, 13848073963, 33980350373
OFFSET
1,1
COMMENTS
Given p(i) the i-th prime number, the gap sequence of length n for prime p(i) is defined as: p(i+1)-p(i), p(i+2)-p(i+1), ..., p(i+n)-p(i+n-1). E.g., the length 3 gap sequence of 7 is [11-7, 13-11, 17-13] is [4, 2, 4].
EXAMPLE
For n = 5, the largest prime with a distinct gap sequence is 47. For all primes up to and including 47, the length 5 gap sequences are distinct, while the next prime, 53, has a gap sequence equal to 23, namely [6, 2, 6, 4, 2].
PROG
(Python)
from sympy import primerange
primes = list(primerange(100_000))
prime_gaps = tuple(q - p for p, q in zip(primes[1:], primes))
def a(n):
seen = set()
for i in range(1, len(primes) - n + 1):
new_gaps = tuple(prime_gaps[i: i + n])
if new_gaps in seen:
return primes[i - 1]
seen.add(new_gaps)
return -1
print(*[a(n) for n in range(1, 14)], sep=', ')
# David Radcliffe, May 10 2025
CROSSREFS
Cf. A001223.
Sequence in context: A386752 A349604 A325894 * A176269 A393776 A343644
KEYWORD
nonn,more
AUTHOR
Leo Vandriel, Feb 21 2024
STATUS
approved