A243916 Largest safe prime less than 2^n.
7, 11, 23, 59, 107, 227, 503, 1019, 2039, 4079, 8147, 16223, 32603, 65267, 130787, 262127, 524243, 1048343, 2097143, 4194287, 8388287, 16776899, 33553799, 67108187, 134217323, 268435019, 536870723, 1073740439, 2147483579, 4294967087
Offset: 3
Keywords
Links
- Gokberk Yaltirakli, Table of n, a(n) for n = 3..1024 (terms 3..100 from Harvey P. Dale)
Programs
-
Mathematica
lsp[n_]:=Module[{sp=NextPrime[2^n,-1]},While[!PrimeQ[(sp-1)/2],sp= NextPrime[ sp,-1]];sp]; Array[lsp,35,3] (* Harvey P. Dale, Feb 10 2019 *)
-
Python
from sympy import isprime def a(n): if n<3: return 0 i=2**n - 1 while True: if isprime(i) and isprime((i - 1)/2): return i else: i-=2 # Indranil Ghosh, Jun 12 2017, after Antti Karttunen's Scheme Code
Comments