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”).

A376946
Smallest k such that 3^(4*3^n) - k is a safe prime.
1
22, 202, 6934, 634, 109678, 445294, 2323138
OFFSET
0,1
COMMENTS
a(7) > 46472.
a(7) > 2*10^7. - Michael S. Branicky, Nov 09 2024
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}]
PROG
(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 #
CROSSREFS
KEYWORD
nonn,more
AUTHOR
STATUS
approved