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.

A260757 Least k > 0 such that M(n)^2 - 2k is prime, where M(n) = 2^n - 1 = A000225(n).

Original entry on oeis.org

1, 2, 1, 1, 1, 4, 1, 1, 7, 10, 1, 10, 1, 10, 5, 1, 14, 24, 1, 1, 13, 1, 16, 3, 82, 1, 19, 1, 23, 94, 64, 58, 7, 6, 14, 3, 46, 22, 5, 13, 107, 69, 38, 90, 59, 75, 104, 25, 4, 10, 14, 4, 44, 10, 5, 1, 77, 81, 85, 94, 71, 9, 14, 111, 13, 27, 20, 9, 37, 6, 5, 4, 62, 12, 38, 4, 37
Offset: 0

Views

Author

M. F. Hasler, Jul 30 2015

Keywords

Comments

For n = 0 and n = 1, no k > 0 can yield a positive prime, the given values are the smallest to yield the opposite of a positive prime: M(0)^2 - 2*1 = 0 - 2 = -2 and M(1)^2 - 2*2 = 1 - 4 = -3.

Examples

			For n = 2, M(2) = 2^2 - 1 = 3 and 3*3 - 2k = 7 is a prime for k=1, thus a(2) = 1.
For n = 3, M(3) = 2^3 - 1 = 7 and 7*7 - 2k = 47 is a prime for k=1, thus a(3) = 1.
For n = 4, M(4) = 2^4 - 1 = 15 and 15*15 - 2k = 223 is a prime for k=1, thus a(4) = 1.
For n = 5, M(5) = 2^5 - 1 = 31 and 31*31 - 2k = 953 is prime for k=4 and no smaller k, thus a(5) = 4.
		

Crossrefs

Cf. A091515 (a(n)=1 for n > 0), A260758.

Programs

  • Maple
    f:= proc(n) local r;
      r:= (2^n-1)^2;
      (r - prevprime(r))/2
    end proc:
    f(0):=1: f(1):= 2:
    map(f, [$0..100]); # Robert Israel, Apr 02 2020
  • Mathematica
    f[n_] := Module[{r = (2^n - 1)^2}, (r - NextPrime[r, -1])/2 ];
    f[0] = 1; f[1] = 2;
    f /@ Range[0, 100] (* Jean-François Alcover, Jul 28 2020, after Robert Israel *)
  • PARI
    a(n)={n>1&&for(k=1,9e9,ispseudoprime((2^n-1)^2-2*k)&&return(k));n+1}

Formula

a(n) = 1 for n=0 or n in A091515.