OFFSET
1,2
COMMENTS
when k=n and 2^n+2^k-1 is prime then the prime is a Mersenne prime and n+1 is prime
LINKS
Pierre CAMI, Table of n, a(n) for n = 1..5017
EXAMPLE
2^1+2^1+1=5 prime as 2^1+2^1-1=3 Mersenne prime so k(1)=1
2^2+2^2-1=7 Mersenne prime so k(2)=2
2^3+2^3+1=17 prime so k(3)=3
2^4+2^4-1=31 Mersenne prime so k(4)=4
2^5+2^4-1=47 prime so k(5)=4
MATHEMATICA
f[n_] := Block[{k = n}, While[ !PrimeQ[2^n + 2^k + 1] && !PrimeQ[2^n + 2^k - 1] && !PrimeQ[2^n - 2^k + 1] && !PrimeQ[2^n - 2^k - 1], k--]; k]; Array[f, 80]
gk[n_]:=Module[{c=2^n, k=n}, While[NoneTrue[{c+2^k+1, c+2^k-1, c-2^k+1, c-2^k- 1}, PrimeQ], k--]; k]; Array[gk, 80] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Mar 05 2019 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Pierre CAMI, Jan 03 2011
STATUS
approved