%I #40 May 11 2023 03:14:35
%S 3,5,7,11,13,23,29,31,47,59,61,127,191,223,239,251,383,479,503,509,
%T 991,1019,1021,2039,3583,3967,4079,4091,4093,6143,8191,15359,16127,
%U 16319,16381,63487,65407,65519,129023,131063,131071,245759,253951,261631,261887,262079,262111,262127,262139
%N Primes of the form 2^t-2^k-1, k>=1.
%C All Mersenne primes A000668(i) are in the sequence, parametrized by t=A000043(i)+1 and k=A000043(i).
%C If p is in the sequence, then the exponents t and k are unique.
%C For given k, the smallest value of t defines sequence A181692.
%C Every term p=2^t-2^k-1 in this sequence here generates an entry 2^(t-1)*p in A181595 (cf. A181701).
%H Reinhard Zumkeller, <a href="/A181741/b181741.txt">Table of n, a(n) for n = 1..1000, probable primes for n > 150</a>
%H Paul Pollack and Vladimir Shevelev, <a href="https://doi.org/10.1016/j.jnt.2012.06.008">On perfect and near-perfect numbers</a>, J. Number Theory 132 (2012), pp. 3037-3046. - _N. J. A. Sloane_, Sep 04 2012
%H Vladimir Shevelev, <a href="http://arxiv.org/abs/1011.6160">Perfect and near-perfect numbers</a>, arXiv:1011.6160 [math.NT], 2010-2012.
%F Conjecture: equals the intersection of A000040 and A081118 or the intersection of A000040 and A089633. [_R. J. Mathar_, Nov 18 2010]
%p isA000079 := proc(n) if n = 1 then true; elif type(n,'odd') then false; else if nops( numtheory[factorset](n) ) = 1 then true; else
%p false; end if; end if; end proc:
%p isA181741 := proc(p) if isprime(p) then k := A007814(p+1) ; (p+1)/2^k+1 ; return ( isA000079(%) and k >=1 ) ; else
%p false; end if; end proc:
%p for i from 1 to 1000 do p := ithprime(i) ; if isA181741(p) then printf("%d,",p) ; end if; end do: # _R. J. Mathar_, Nov 18 2010
%t Select[Table[2^t-2^k-1, {t, 1, 20}, {k, 1, t-1}] // Flatten // Union, PrimeQ] (* _Jean-François Alcover_, Nov 16 2017 *)
%o (Haskell)
%o a181741 n = a181741_list !! (n-1)
%o a181741_list = filter ((== 1) . a010051) a081118_list
%o -- _Reinhard Zumkeller_, Feb 23 2012
%o (PARI) lista(nn) = {for (n=3, nn, forstep(k=n-1, 1, -1, if (isprime(p=2^n-2^k-1), print1(p, ", "));););} \\ _Michel Marcus_, Dec 17 2018
%o (Python)
%o from itertools import count, islice
%o from sympy import isprime
%o def A181741_gen(): # generator of terms
%o m = 2
%o for t in count(1):
%o r=1<<t-1
%o for k in range(t-1,0,-1):
%o if isprime(s:=m-r-1):
%o yield s
%o r>>=1
%o m<<=1
%o A181741_list = list(islice(A181741_gen(),30)) # _Chai Wah Wu_, Jul 08 2022
%Y Cf. A181595, A181692, A181701, A000043.
%Y Cf. A010051, primes in A081118, see also A208083.
%K nonn
%O 1,1
%A _Vladimir Shevelev_, Nov 08 2010
%E Corrected (251 and 1019 inserted) and extended by _R. J. Mathar_, Nov 18 2010