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.

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

This page as a plain text file.
%I A360080 #22 Jan 29 2023 17:52:24
%S A360080 1,7,7,7,91,3103,12451,230191,286867,1657867,10029811,29761351,
%T A360080 22410151,98402791,167137543
%N A360080 Smallest k such that 2^(2^n) + k is a safe prime.
%C A360080 a(n) == 3 (mod 4) for n > 1. - _Chai Wah Wu_, Jan 27 2023
%F A360080 a(n) = A350696(2^n).
%e A360080 a(3) = 7 because 2^(2^3) + 7 = 263 is the smallest safe prime greater than 256.
%o A360080 (PARI) a(n) = {my(k=1); pow2 = 2^(2^n);   while (!(isprime(pow2 + k) && isprime((pow2 + k - 1)/2)), k+=2); k;} \\
%o A360080 (Python)
%o A360080 from sympy import isprime, nextprime
%o A360080 def A360080(n):
%o A360080     if n <= 1: return 1
%o A360080     m = 1<<(1<<n)-1
%o A360080     i = m
%o A360080     while i:=nextprime(i):
%o A360080         if isprime(k:=(i<<1)+1):
%o A360080             return k-(m<<1) # _Chai Wah Wu_, Jan 27 2023
%Y A360080 Cf. A360081, A181356, A005385, A058220, A013597, A013603, A335313, A350696.
%K A360080 nonn,more,hard
%O A360080 1,2
%A A360080 _Mark Andreas_, Jan 25 2023