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-2 of 2 results.

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); }

A367966 Smallest Sophie Germain prime >= 2^n.

Original entry on oeis.org

2, 2, 5, 11, 23, 41, 83, 131, 281, 593, 1031, 2063, 4211, 8243, 16421, 32771, 65633, 131321, 262193, 524351, 1048889, 2097629, 4194581, 8388953, 16777259, 33554771, 67108913, 134218433, 268435631, 536871311, 1073741891, 2147483693, 4294967681, 8589934631, 17179869659
Offset: 0

Views

Author

Andrei Lapets, Dec 06 2023

Keywords

Examples

			For n = 0, a(0) = 2 because 2 is prime, 2*(2) + 1 = 5 is prime, 2 >= 2^0 where 2^0 = 1, and 1 is not prime.
For n = 1, a(1) = 2 because 2 is prime, 2*(2) + 1 = 5 is prime, 2 >= 2^1 where 2^1 = 2.
For n = 2, a(2) = 5 because 5 is prime, 2*(5) + 1 = 11 is prime, 5 >= 2^2 where 2^2 = 4, and 4 is not prime.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; local p; for p from 2^n
          while not andmap(isprime, [p, 2*p+1]) do od; p
        end:
    seq(a(n), n=0..44);  # Alois P. Heinz, Dec 13 2023
  • Mathematica
    a={}; nmax=35; For[n=0, n<=nmax, n++, k=2^n; While[!PrimeQ[k] || !PrimeQ[2k+1], k++]; AppendTo[a,k]]; a (* Stefano Spezia, Dec 10 2023 *)
  • PARI
    a(n) = forprime(p=2^n, , if (isprime(2*p+1), return(p))); \\ Michel Marcus, Dec 12 2023

Formula

Apparently a(n) = (A111671(n) - 1)/2 for n>=2. - Hugo Pfoertner, Dec 13 2023
Showing 1-2 of 2 results.