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.

A057160 Smallest value of k for which the expression k*2^(2^n-1)-1 is prime.

Original entry on oeis.org

3, 2, 1, 1, 4, 1, 6, 1, 90, 111, 244, 139, 880, 309, 22263, 56083, 130141, 49905
Offset: 0

Views

Author

Steven Harvey, Sep 14 2000

Keywords

Examples

			a(1)=2 because 2*2^(2^1-1)-1 = 2*2^1-1 = 3 which is prime. - _Sean A. Irvine_, May 25 2022
a(4)=4 because 4*2^(2^4-1)-1 = 4*2^15-1 = 4*32768-1 = 131071 which is prime.
		

Crossrefs

Cf. A053989, A058891, A077585 (2^(2^n-1)-1).

Programs

  • Mathematica
    svk[n_]:= Module[{k = 1, c = 2^(2^n-1)}, While[!PrimeQ[k*c-1],k++];k]; Join[{2}, svk /@ Range[17]] (* Harvey P. Dale, Feb 03 2021, adjusted for new offset by Michael De Vlieger, May 25 2022 *)
  • PARI
    a(n) = my(k=1); while (!isprime(k*2^(2^n-1)-1), k++); k; \\ Michel Marcus, May 27 2022
  • Python
    from sympy import isprime
    def a(n):
        k, c = 1, 2**(2**n-1)
        while not isprime(k*c - 1): k += 1
        return k
    print([a(n) for n in range(1, 12)]) # Michael S. Branicky, May 25 2022
    

Formula

a(n) = A053989(A058891(n+1)). - Pontus von Brömssen, May 27 2022

Extensions

Offset and a(1) corrected by Sean A. Irvine, May 25 2022
a(0) prepended by Michel Marcus, May 27 2022