login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

a(n) = 1 if the number of divisors of n is a power of 2, otherwise 0.
3

%I #17 Jan 05 2023 03:20:07

%S 1,1,1,0,1,1,1,1,0,1,1,0,1,1,1,0,1,0,1,0,1,1,1,1,0,1,1,0,1,1,1,0,1,1,

%T 1,0,1,1,1,1,1,1,1,0,0,1,1,0,0,0,1,0,1,1,1,1,1,1,1,0,1,1,0,0,1,1,1,0,

%U 1,1,1,0,1,1,0,0,1,1,1,0,0,1,1,0,1,1,1,1,1,0,1,0,1,1,1,0,1,0,0,0,1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,0,0,1,1,1

%N a(n) = 1 if the number of divisors of n is a power of 2, otherwise 0.

%H Antti Karttunen, <a href="/A359473/b359473.txt">Table of n, a(n) for n = 1..100000</a>

%H <a href="/index/Ch#char_fns">Index entries for characteristic functions</a>.

%H <a href="/index/Eu#epf">Index entries for sequences computed from exponents in factorization of n</a>.

%F a(n) = A209229(A000005(n)).

%F a(n) = [A348341(n) == 0], where [ ] is the Iverson bracket.

%F A359472(n) <= a(n) <= A295316(n).

%F Sum_{k=1..n} a(k) ~ c * n, where c = A327839. - _Amiram Eldar_, Jan 05 2023

%t a[n_] := If[IntegerQ@Log2[DivisorSigma[0, n]], 1, 0]; Array[a, 100] (* _Amiram Eldar_, Jan 05 2023 *)

%o (PARI)

%o A209229(n) = (n && !bitand(n,n-1));

%o A359473(n) = A209229(numdiv(n));

%o (Python)

%o from sympy import factorint

%o def A359473(n): return int(all(map(lambda m:not((k:=m+1)&-k)^k,factorint(n).values()))) # _Chai Wah Wu_, Jan 04 2023

%Y Characteristic function of A036537, whose complement A162643 gives the positions of 0's.

%Y Cf. A000005, A209229, A295316, A327839, A348341, A359472.

%K nonn

%O 1

%A _Antti Karttunen_, Jan 04 2023