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.

Original entry on oeis.org

2, 3, 11, 5, 227, 17, 65837, 1607, 19427, 2397347207, 153535525937, 157542769194527, 29503289812427, 32467505340816977, 1109038455070356527, 143924005810811657, 305948728878647722727
Offset: 1

Views

Author

Robert C. Lyons, Aug 18 2022

Keywords

Comments

This sequence is a variation of A164926.
a(15) > 10^18. - Bert Dobbelaere, Aug 28 2022

Examples

			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.
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.
		

Crossrefs

Cf. A164926.

Programs

  • Python
    import sympy
    def get_longest_run_of_primes(p):
        run = [p]
        x = 2
        while True:
            next_prime = 2**x - 2 + p
            if sympy.isprime(next_prime):
                run.append(next_prime)
                x = x + 1
            else:
                break
        return run
    n_to_longest_run_map = {}
    max_prime_index = 100000
    for prime_index in range(1, max_prime_index+1):
        p = sympy.prime(prime_index)
        longest_run_for_p = get_longest_run_of_primes(p)
        length_of_longest_run_for_p = len(longest_run_for_p)
        if length_of_longest_run_for_p not in n_to_longest_run_map:
            n_to_longest_run_map[length_of_longest_run_for_p] = longest_run_for_p
    n = 1
    seq = []
    while n in n_to_longest_run_map:
        seq.append(n_to_longest_run_map[n][0])
        n = n + 1
    print(seq)

Extensions

a(10)-a(14), a(16) from Bert Dobbelaere, Aug 28 2022
a(15) from Norman Luhn, Dec 15 2022
a(17) from Norman Luhn, Dec 17 2022