login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A243916 Largest safe prime less than 2^n. 4
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 (list; graph; refs; listen; history; text; internal format)
OFFSET
3,1
COMMENTS
Largest safe prime (A005385) p=2*q+1, q also prime (A005384), that can be represented using n binary digits.
LINKS
Gokberk Yaltirakli, Table of n, a(n) for n = 3..1024 (terms 3..100 from Harvey P. Dale)
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 *)
PROG
(MIT/GNU Scheme, with Aubrey Jaffer's SLIB Scheme library)
(require 'factor) ;; For prime? predicate.
(define (A243916 n) (if (< n 3) 0 (let loop ((i (- (expt 2 n) 1))) (cond ((and (prime? i) (prime? (/ (- i 1) 2))) i) (else (loop (- i 2)))))))
;; Antti Karttunen, Jun 18 2014
(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
CROSSREFS
Sequence in context: A140111 A118072 A141305 * A181841 A076855 A160054
KEYWORD
nonn
AUTHOR
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 3 04:18 EST 2024. Contains 370499 sequences. (Running on oeis4.)