cp's OEIS Frontend

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.

A243916 Largest safe prime less than 2^n.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Largest safe prime (A005385) p=2*q+1, q also prime (A005384), that can be represented using n binary digits.

Crossrefs

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