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.
%I A243916 #33 Jun 25 2023 03:31:26 %S A243916 7,11,23,59,107,227,503,1019,2039,4079,8147,16223,32603,65267,130787, %T A243916 262127,524243,1048343,2097143,4194287,8388287,16776899,33553799, %U A243916 67108187,134217323,268435019,536870723,1073740439,2147483579,4294967087 %N A243916 Largest safe prime less than 2^n. %C A243916 Largest safe prime (A005385) p=2*q+1, q also prime (A005384), that can be represented using n binary digits. %H A243916 Gokberk Yaltirakli, <a href="/A243916/b243916.txt">Table of n, a(n) for n = 3..1024</a> (terms 3..100 from Harvey P. Dale) %t A243916 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 *) %o A243916 (MIT/GNU Scheme, with Aubrey Jaffer's SLIB Scheme library) %o A243916 (require 'factor) ;; For prime? predicate. %o A243916 (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))))))) %o A243916 ;; _Antti Karttunen_, Jun 18 2014 %o A243916 (Python) %o A243916 from sympy import isprime %o A243916 def a(n): %o A243916 if n<3: return 0 %o A243916 i=2**n - 1 %o A243916 while True: %o A243916 if isprime(i) and isprime((i - 1)/2): return i %o A243916 else: i-=2 # _Indranil Ghosh_, Jun 12 2017, after _Antti Karttunen_'s Scheme Code %Y A243916 Cf. A005385, A005384, A000079. %K A243916 nonn %O A243916 3,1 %A A243916 _José Eduardo Gaboardi de Carvalho_, Jun 18 2014