OFFSET
1,1
COMMENTS
If k = 2^j then 2^(j+1)-1 is a Mersenne prime.
LINKS
Pierre CAMI, Table of n, a(n) for n = 1..1500
EXAMPLE
2*2^3 - 1 = 15 is composite, but 2*3^3 - 1 = 53 is prime so a(3) = 3.
MAPLE
f:= proc(n)
local k;
for k from 2 do
if isprime(2*k^n-1) then return(k) fi
od
end proc:
seq(f(n), n=1..100); # Robert Israel, Aug 10 2014
PROG
(PFGW & SCRIPT)
SCRIPT
DIM n, 0
DIM k, 0
DIMS t
OPENFILEOUT myf, a(n).txt
LABEL loop1
SET n, n+1
SET k, 1
LABEL loop2
SET k, k+1
SETS t, %d, %d\,; n; k
PRP 2*k^n-1, t
IF ISPRP THEN GOTO a
GOTO loop2
LABEL a
WRITE myf, t
GOTO loop1
(PARI)
a(n)=k=1; while(!ispseudoprime(2*k^n-1), k++); return(k)
vector(100, n, a(n)) \\ Derek Orr, Aug 10 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
Pierre CAMI, Mar 09 2009
STATUS
approved