login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A157922 Least k such that 2*k^n - 1 is prime, or 0 if no such k exists. 1
2, 2, 3, 2, 6, 2, 3, 3, 4, 8, 40, 2, 12, 7, 4, 2, 81, 2, 138, 3, 19, 16, 3, 5, 30, 6, 3, 9, 7, 2, 9, 52, 21, 9, 3, 6, 114, 31, 66, 6, 82, 8, 148, 4, 6, 7, 76, 12, 6, 24, 85, 6, 4, 5, 133, 3, 12, 188, 111, 2, 45, 3, 4, 13, 84, 12, 268, 3, 192, 36, 126, 59, 22, 17, 6, 13, 445, 95, 414, 7 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
If k = 2^j then 2^(j+1)-1 is a Mersenne prime.
LINKS
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
Cf. A000668.
Sequence in context: A340693 A275382 A199583 * A343655 A015995 A068903
KEYWORD
nonn
AUTHOR
Pierre CAMI, Mar 09 2009
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 12:44 EDT 2024. Contains 371913 sequences. (Running on oeis4.)