[go: up one dir, main page]

login
A344865
a(n) is the largest k such that no subsequence of n numbers appears more than once in the sequence of the first k prime gaps while overlapping subsequences are allowed.
0
2, 5, 6, 7, 19, 59, 88, 89, 1213, 1214, 3876, 3877, 3878, 10252040
OFFSET
1,1
EXAMPLE
a(5) is 19 because when we look at the first 19 prime gaps, there is no sequence of 5 numbers that occurs twice. If we look at the first 20 prime gaps, there is a repetition.
PROG
(Python)
from sympy import primerange
list_of_prime_gaps = [x - y for x, y in zip(primerange(3, 40000),
primerange(1, 40000))]
def a(n):
saved = set()
for i in range(1, len(list_of_prime_gaps)-n):
sequence = list_of_prime_gaps[i:i+n]
if tuple(sequence) in saved:
return i + n - 1
saved.add(tuple(sequence))
return None
for n in range(1, 14):
print(a(n), end=", ")
CROSSREFS
Cf. A001223 (prime gaps).
Sequence in context: A014489 A286270 A346880 * A350130 A033959 A167455
KEYWORD
nonn,more
AUTHOR
Armin Schäfer, May 31 2021
EXTENSIONS
a(14) from Armin Schäfer, Aug 08 2021
STATUS
approved