OFFSET
1,1
COMMENTS
a(n) = 2 when 2*n + 1 is a prime Mersenne exponent (A000043).
LINKS
Pierre CAMI, Table of n, a(n) for n = 1..700
EXAMPLE
2*2^(2*1) - 1 = 7 prime so a(1) = 2.
2*2^(2*2) - 1 = 31 prime so a(2) = 2.
2*2^(2*3) - 1 = 127 prime so a(3) = 2.
MAPLE
A:= proc(n)
local p;
p:= 2;
while not isprime(2*p^(2*n)-1) do p:= nextprime(p) od:
p;
end proc:
seq(A(n), n=1..100); # Robert Israel, Sep 14 2014
MATHEMATICA
a240166[n_Integer] := Module[{p = 1},
While[! PrimeQ[2*Prime[p]^(2*n) - 1], p++]; Prime[p]]; a240166 /@ Range[120] (* Michael De Vlieger, Aug 12 2014 *)
PROG
(PFGW & SCRIPT)
SCRIPT
DIM i
DIM n, 0
DIM k
DIMS t
OPENFILEOUT myf, a(n).txt
LABEL loop1
SET n, n+1
SET i, 0
LABEL loop2
SET i, i+1
SETS t, %d, %d\ ; n; p(i)
PRP 2*p(i)^(2*n)-1, t
IF ISPRP THEN GOTO a
GOTO loop2
LABEL a
WRITE myf, t
GOTO loop1
(PARI) a(n) = p=2; while(!ispseudoprime(2*p^(2*n)-1), p=nextprime(p+1)); p
vector(70, n, a(n)) \\ Colin Barker, Aug 02 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
Pierre CAMI, Aug 02 2014
STATUS
approved