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.

A354585 Least prime p such that 2^x - 2 + p produces primes for x=1..n and a composite for x=n+1.

This page as a plain text file.
%I A354585 #32 Dec 17 2022 08:22:00
%S A354585 2,3,11,5,227,17,65837,1607,19427,2397347207,153535525937,
%T A354585 157542769194527,29503289812427,32467505340816977,1109038455070356527,
%U A354585 143924005810811657,305948728878647722727
%N A354585 Least prime p such that 2^x - 2 + p produces primes for x=1..n and a composite for x=n+1.
%C A354585 This sequence is a variation of A164926.
%C A354585 a(15) > 10^18. - _Bert Dobbelaere_, Aug 28 2022
%e A354585 For n=5, 227 is the smallest prime such that 2^x - 2 + p produces primes for x=1..n and a composite for x=n+1. The following are the 5 primes that are produced: 227, 229, 233, 241, 257; note that the consecutive differences are 2, 4, 8, and 16.
%e A354585 For n=6, 17 is the smallest prime such that 2^x - 2 + p produces primes for x=1..n and a composite for x=n+1. The following are the 6 primes that are produced: 17, 19, 23, 31, 47, 79; note that the consecutive differences are 2, 4, 8, 16, and 32.
%o A354585 (Python)
%o A354585 import sympy
%o A354585 def get_longest_run_of_primes(p):
%o A354585     run = [p]
%o A354585     x = 2
%o A354585     while True:
%o A354585         next_prime = 2**x - 2 + p
%o A354585         if sympy.isprime(next_prime):
%o A354585             run.append(next_prime)
%o A354585             x = x + 1
%o A354585         else:
%o A354585             break
%o A354585     return run
%o A354585 n_to_longest_run_map = {}
%o A354585 max_prime_index = 100000
%o A354585 for prime_index in range(1, max_prime_index+1):
%o A354585     p = sympy.prime(prime_index)
%o A354585     longest_run_for_p = get_longest_run_of_primes(p)
%o A354585     length_of_longest_run_for_p = len(longest_run_for_p)
%o A354585     if length_of_longest_run_for_p not in n_to_longest_run_map:
%o A354585         n_to_longest_run_map[length_of_longest_run_for_p] = longest_run_for_p
%o A354585 n = 1
%o A354585 seq = []
%o A354585 while n in n_to_longest_run_map:
%o A354585     seq.append(n_to_longest_run_map[n][0])
%o A354585     n = n + 1
%o A354585 print(seq)
%Y A354585 Cf. A164926.
%K A354585 nonn,hard,more
%O A354585 1,1
%A A354585 _Robert C. Lyons_, Aug 18 2022
%E A354585 a(10)-a(14), a(16) from _Bert Dobbelaere_, Aug 28 2022
%E A354585 a(15) from _Norman Luhn_, Dec 15 2022
%E A354585 a(17) from _Norman Luhn_, Dec 17 2022