Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #20 Sep 08 2022 08:46:25
%S 2,5,3,7,47,31,191,127,16127,3583,15359,6143,1044479,8191,245759,
%T 16744447,4128767,131071,786431,524287,274876858367,14680063,
%U 4398042316799,260046847,4278190079,4261412863,1125899839733759,576460752169205759,16911433727
%N a(n) is the least prime of the form 2^m - 2^n - 1.
%H Robert Israel, <a href="/A331217/b331217.txt">Table of n, a(n) for n = 0..680</a>
%e a(1) = 2: 2^2 - 2^0 - 1 = 2, thus exponent 2 = A181692(0);
%e a(2) = 5: 2^3 - 2^1 - 1 = 5, 2^2 - 2^1 - 1 = 1 is not a prime, A181692(1) = 3;
%e a(4) = 47: 2^6 - 2^4 - 1 = 31, whereas the first candidate 2^5 - 2^4 - 1 = 15 is composite.
%p f:= proc(n) local m, p;
%p p:= -1;
%p for m from n do
%p p:= p + 2^m;
%p if isprime(p) then return p fi
%p od
%p end proc:
%p map(f, [$0..30]); # _Robert Israel_, Jan 13 2020
%t a[n_] := For[m = n+1, True, m++, If[PrimeQ[p = 2^m-2^n-1], Return[p]]];
%t a /@ Range[0, 28] (* _Jean-François Alcover_, Oct 25 2020 *)
%o (PARI) for(n=0,28, for(m=n+1,oo, k=2^m-2^n-1; if(isprime(k), print1(k,", "); break)))
%o (Magma) a:=[]; for n in [0..30] do m:=n+1; while not IsPrime(2^m-2^n-1) do m:=m+1; end while; Append(~a,2^m-2^n-1); end for; a; // _Marius A. Burtea_, Jan 13 2020
%Y Cf. A181692 (corresponding values of m), A331204, A331205.
%K nonn
%O 0,1
%A _Hugo Pfoertner_, Jan 12 2020