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.

A238694 Smallest k such that 2^n - k and k*2^n - 1 are both prime or 0 if no such k exists.

Original entry on oeis.org

0, 1, 1, 3, 1, 3, 1, 5, 25, 5, 31, 5, 1, 15, 49, 17, 1, 5, 1, 17, 9, 33, 69, 89, 61, 111, 199, 309, 75, 297, 1, 5, 49, 131, 31, 17, 31, 131, 165, 437, 55, 33, 309, 495, 361, 437, 999, 89, 139, 195, 129, 183, 685, 315, 915, 189, 585, 1035, 931, 93, 1, 57, 165
Offset: 1

Views

Author

Keywords

Comments

If a(n)=1, then the two primes are same and they are Mersenne primes (A000668).

Examples

			a(9) = 25 because 2^9 - 25  = 487 and 25*2^9 - 1 = 12799 are both prime.
		

Crossrefs

Cf. A238554.

Programs

  • Maple
    a:= proc(n) local k, p; p:= 2^n;
          for k while not (isprime(p-k) and isprime(k*p-1))
            do if k>=p then return 0 fi od; k
        end:
    seq(a(n), n=1..70);  # Alois P. Heinz, Mar 03 2014
  • Mathematica
    a[n_] := Module[{k, p}, p = 2^n;
         For[k = 1, !(PrimeQ[p - k] && PrimeQ[k*p - 1]), k++,
               If[k >= p, Return[0]]]; k];
    Table[a[n], {n, 1, 70}] (* Jean-François Alcover, Feb 18 2022, after Alois P. Heinz *)

Extensions

More terms from Alois P. Heinz, Mar 03 2014