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.

Showing 1-6 of 6 results.

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

Views

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

A350696 a(n) is the least nonnegative integer k such that 2^n + k is a safe prime.

Original entry on oeis.org

1, 3, 7, 15, 19, 39, 7, 51, 163, 15, 31, 231, 103, 75, 7, 195, 499, 99, 127, 627, 955, 555, 691, 87, 679, 99, 1411, 351, 799, 135, 91, 771, 79, 951, 667, 975, 1183, 1311, 667, 315, 955, 759, 2011, 9315, 4243, 1575, 907, 1527, 3943, 2091, 1927, 75, 1879
Offset: 2

Views

Author

Mark Andreas, Jan 12 2022

Keywords

Comments

2^n+a(n) is the smallest (n+1)-bit safe prime.

Examples

			a(6)=19 because 2^6+19=83 is the smallest safe prime greater than 64 of the form p=2q+1 where p and q are both primes.
		

Crossrefs

Programs

  • Mathematica
    safeQ[p_] := And @@ PrimeQ[{p, (p - 1)/2}]; a[n_] := Module[{k = 2^n + 1}, While[! safeQ[k], k++]; k -= 2^n]; Array[a, 50, 2] (* Amiram Eldar, Jan 12 2022 *)
  • PARI
    a(n) = {my(k=0); until (isprime(2^n+k) && isprime((2^n+k-1)/2), k++); return (k); }

A360080 Smallest k such that 2^(2^n) + k is a safe prime.

Original entry on oeis.org

1, 7, 7, 7, 91, 3103, 12451, 230191, 286867, 1657867, 10029811, 29761351, 22410151, 98402791, 167137543
Offset: 1

Views

Author

Mark Andreas, Jan 25 2023

Keywords

Comments

a(n) == 3 (mod 4) for n > 1. - Chai Wah Wu, Jan 27 2023

Examples

			a(3) = 7 because 2^(2^3) + 7 = 263 is the smallest safe prime greater than 256.
		

Crossrefs

Programs

  • PARI
    a(n) = {my(k=1); pow2 = 2^(2^n);   while (!(isprime(pow2 + k) && isprime((pow2 + k - 1)/2)), k+=2); k;} \\
    
  • Python
    from sympy import isprime, nextprime
    def A360080(n):
        if n <= 1: return 1
        m = 1<<(1<Chai Wah Wu, Jan 27 2023

Formula

a(n) = A350696(2^n).

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

Original entry on oeis.org

3, 19, 31, 691, 907, 2887, 15943, 69283, 216127, 1108831, 8344423, 10976347, 166965391, 385465771, 26580643
Offset: 0

Views

Author

Mark Andreas, Jan 25 2023

Keywords

Comments

a(n) == 3 (mod 4). - Chai Wah Wu, Jan 27 2023

Examples

			a(1) = 19 because 2^(3*2^1)+19 = 2^6+19 = 83 is the smallest safe prime greater than 64.
		

Crossrefs

Programs

  • PARI
    a(n) = {my(k=1); pow2 = 2^(3*2^n); while (!(isprime(pow2 + k) && isprime((pow2 + k - 1)/2)), k+=2); k;} \\
    
  • Python
    from sympy import isprime, nextprime
    def A360081(n):
        m = 1<<3*(1<Chai Wah Wu, Jan 27 2023

Formula

a(n) = A350696(3*2^n).

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

Original entry on oeis.org

22, 202, 6934, 634, 109678, 445294, 2323138
Offset: 0

Views

Author

J.W.L. (Jan) Eerland, Oct 10 2024

Keywords

Comments

a(7) > 46472.
a(7) > 2*10^7. - Michael S. Branicky, Nov 09 2024

Crossrefs

Programs

  • Mathematica
    Table[m = 3;
     k = 0; Monitor[
      Parallelize[
       While[True,
        If[And[PrimeQ[m^((m + 1)*m^n) - k],
          PrimeQ[((m^((m + 1)*m^n) - k) - 1)/2]], Break[]]; k++]; k],
      k], {n, 0, 5}]
  • PARI
    a(n) = {my(k=0); while (!(isprime(p=3^(4*3^n) - k) && isprime((p-1)/2)), k++); k;}
    
  • Python
    from sympy import isprime, prevprime
    def A(n):
        m = 3**(4*3**n)
        p = prevprime(m)
        while not isprime((p-1)//2):
            p = prevprime(p)
        return m-p #

A377724 Smallest k such that 4^(5*4^n) - k is a safe prime.

Original entry on oeis.org

5, 437, 13709, 40169, 574133
Offset: 0

Views

Author

J.W.L. (Jan) Eerland, Nov 05 2024

Keywords

Comments

a(5) > 2*10^7. - Michael S. Branicky, Nov 09 2024

Crossrefs

Programs

  • Mathematica
    Table[m = 4;
     k = 0; Monitor[
      Parallelize[
       While[True,
        If[And[PrimeQ[m^((m + 1)*m^n) - k],
          PrimeQ[((m^((m + 1)*m^n) - k) - 1)/2]], Break[]]; k++]; k],k], {n, 0, 5}]
  • PARI
    a(n) = {my(k=0); while (!(isprime(p=4^(5*4^n) - k) && isprime((p-1)/2)), k++); k;}
    
  • Python
    from sympy import isprime, prevprime
    def A(n):
        m = 4**(5*4**n)
        p = prevprime(m)
        while not isprime((p-1)//2):
            p = prevprime(p)
        return m-p #
Showing 1-6 of 6 results.