OFFSET
2,2
COMMENTS
2^n+a(n) is the smallest (n+1)-bit safe prime.
LINKS
Mark Andreas, Table of n, a(n) for n = 2..5120
EXAMPLE
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.
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 *)
PROG
(PARI) a(n) = {my(k=0); until (isprime(2^n+k) && isprime((2^n+k-1)/2), k++); return (k); }
CROSSREFS
KEYWORD
nonn
AUTHOR
Mark Andreas, Jan 12 2022
STATUS
approved