%I #18 May 20 2020 07:40:40
%S 2,5,7,13,23,29,37,41,53,61,73,101,103,109,113,127,137,151,157,167,
%T 173,181,193,229,257,263,269,277,281,311,313,317,353,373,383,389,397,
%U 401,409,421,433,439,457,461,487,509,541,569,593,601,613,617,631,641,653
%N Primes p where the number of divisors of p+1 is a power of 2.
%H Alois P. Heinz, <a href="/A165319/b165319.txt">Table of n, a(n) for n = 1..20000</a>
%p b:= proc(n) option remember; is(n=2^ilog2(n)) end:
%p a:= proc(n) option remember; local p; p:= `if`(n=1, 1, a(n-1));
%p do p:= nextprime(p);
%p if andmap(b, map(i-> i[2]+1, ifactors(p+1)[2])) then break fi
%p od; p
%p end:
%p seq(a(n), n=1..55); # _Alois P. Heinz_, Sep 05 2019
%t okQ[p_] := PrimeQ[p] && IntegerQ[Log[2, DivisorSigma[0, p+1]]];
%t Select[Prime[Range[200]], okQ] (* _Jean-François Alcover_, May 20 2020 *)
%o (PARI) isok(p) = isprime(p) && (nd = numdiv(p+1)) && (nd == 2^valuation(nd, 2)); \\ _Michel Marcus_, Sep 05 2019
%Y Cf. A165318, A165320.
%Y Cf. A008329. [_R. J. Mathar_, Sep 20 2009]
%K nonn
%O 1,1
%A _Leroy Quet_, Sep 14 2009
%E Extended by _R. J. Mathar_, Sep 20 2009
|