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.

User: Artsiom Palkounikau

Artsiom Palkounikau's wiki page.

Artsiom Palkounikau has authored 2 sequences.

A345014 a(n) is the least nonnegative integer k such that 2^n - k is a Sophie Germain prime.

Original entry on oeis.org

0, 1, 3, 5, 3, 11, 15, 5, 3, 5, 9, 23, 81, 83, 135, 143, 9, 23, 117, 5, 9, 161, 159, 317, 339, 203, 219, 95, 693, 35, 105, 5, 321, 425, 69, 23, 201, 191, 219, 983, 1101, 371, 747, 287, 429, 743, 2649, 1355, 81, 233, 237, 635, 2403, 395, 1125, 1997, 69, 9005
Offset: 1

Author

Artsiom Palkounikau, Sep 15 2021

Keywords

Crossrefs

Programs

  • Mathematica
    Table[k=0;While[!(PrimeQ[p=2^n-k]&&PrimeQ[2p+1]),k++];k,{n,58}] (* Giorgos Kalogeropoulos, Sep 15 2021 *)
  • PARI
    a(n) = my(k=0,p); while (!(isprime(p=2^n-k) && isprime(2*p+1)), k++); k; \\ Michel Marcus, Sep 15 2021
  • Python
    from sympy import isprime
    def a(n):
        k = 0
        while True:
            if isprime(2 ** n - k) and isprime(2 * (2 ** n - k) + 1):
                return k
            k += 1
    print([a(i) for i in range(1, 21)])
    

Formula

a(n) = (A057821(n+1) + 1)/2.

A335313 Smallest k such that 2^(3*2^n) - k is a safe prime.

Original entry on oeis.org

1, 5, 17, 317, 5297, 3449, 41213, 59057, 468857, 1503317, 1103717, 40207829, 154474973, 1162354373, 18153497
Offset: 0

Author

Artsiom Palkounikau, Jun 01 2020

Keywords

Examples

			a(1) = 5 because 2^(3*2^1)-5 = 2^6-5 = 59 is the largest safe prime less than 64.
		

Crossrefs

Cf. A005385 (safe primes), A057821, A181356.

Programs

  • PARI
    a(n) = {my(k=0); while (!(isprime(p=2^(3*2^n) - k) && isprime((p-1)/2)), k++); k;} \\ Michel Marcus, Jun 01 2020
    
  • Python
    from sympy import isprime, prevprime
    def A335313(n):
        m = 2**(3*2**n)
        p = prevprime(m)
        while not isprime((p-1)//2):
            p = prevprime(p)
        return m-p # Chai Wah Wu, Jul 09 2020

Extensions

a(13) from Artsiom Palkounikau, Oct 13 2021
a(14) from Mark Andreas, Jun 06 2022