A057821 a(n) is the least nonnegative integer k such that 2^n - k is a safe prime.
1, 5, 9, 5, 21, 29, 9, 5, 9, 17, 45, 161, 165, 269, 285, 17, 45, 233, 9, 17, 321, 317, 633, 677, 405, 437, 189, 1385, 69, 209, 9, 641, 849, 137, 45, 401, 381, 437, 1965, 2201, 741, 1493, 573, 857, 1485, 5297, 2709, 161, 465, 473, 1269, 4805, 789
Offset: 3
Keywords
Links
- Mark Andreas, Table of n, a(n) for n = 3..5120 (first 3070 terms from Artsiom Palkounikau)
Programs
-
PARI
a(n) = {my(k=0); until (isprime(2^n-k) && isprime((2^n-k-1)/2), k++); return (k);} \\ Michel Marcus, Jun 29 2013
-
Python
from sympy import isprime def a(n): k=0 while True: k+=1 if isprime(2**n - k) and isprime((2**n - k - 1)//2): return k print([a(i) for i in range(3, 21)]) # Indranil Ghosh, Jun 12 2017, after PARI code by Michel Marcus
Comments