login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons 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

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

Cf. A000668.

Sequence in context: A340693 A275382 A199583 * A343655 A015995 A068903

Adjacent sequences:  A157919 A157920 A157921 * A157923 A157924 A157925

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 | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 16 14:52 EDT 2021. Contains 346065 sequences. (Running on oeis4.)