login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A360080
Smallest k such that 2^(2^n) + k is a safe prime.
2
1, 7, 7, 7, 91, 3103, 12451, 230191, 286867, 1657867, 10029811, 29761351, 22410151, 98402791, 167137543
OFFSET
1,2
COMMENTS
a(n) == 3 (mod 4) for n > 1. - Chai Wah Wu, Jan 27 2023
FORMULA
a(n) = A350696(2^n).
EXAMPLE
a(3) = 7 because 2^(2^3) + 7 = 263 is the smallest safe prime greater than 256.
PROG
(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<<n)-1
i = m
while i:=nextprime(i):
if isprime(k:=(i<<1)+1):
return k-(m<<1) # Chai Wah Wu, Jan 27 2023
KEYWORD
nonn,more,hard
AUTHOR
Mark Andreas, Jan 25 2023
STATUS
approved