%I #38 Oct 13 2022 14:57:43
%S 1,1,1,4,1,6,6,11,1,14,11,20,10,28,23,33,1,31,27,41,26,49,36,59,16,58,
%T 41,68,37,62,51,83,1,79,61,88,58,97,85,98,53,115,96,116,63,123,96,128,
%U 41,138,105,144,90,163,128,164,81,172,148,181,124,167,134,201,1
%N Number of 1's in binary expansion of n^n.
%C a(n) + A214562(n) = 1+floor(log_2(n^n)) = 1, 1, 3, 5, 9, 12, 16, 20, 25, 29, 34, 39, 44, 49... is the number of binary digits in n^n. - _R. J. Mathar_, Jul 22 2012
%H Alois P. Heinz, <a href="/A214561/b214561.txt">Table of n, a(n) for n = 0..16384</a>
%F a(n) = A000120(A000312(n)).
%F a(2^k)=1.
%p a:= proc(n) option remember; local m, r;
%p m, r:= n^n, 0;
%p while m>0 do r:= r +irem(m, 2, 'm') od; r
%p end:
%p seq(a(n), n=0..100); # _Alois P. Heinz_, Jul 21 2012
%t Table[Count[IntegerDigits[n^n,2],1],{n,1,64}] (* _Geoffrey Critzer_, Sep 30 2013 *)
%t Join[{1},Table[DigitCount[n^n,2,1],{n,100}]] (* _Harvey P. Dale_, Oct 13 2022 *)
%o (Python)
%o for n in range(300):
%o c = 0
%o b = n**n
%o while b>0:
%o c += b&1
%o b//=2
%o print(c, end=',')
%o (Python)
%o def a(n): return bin(n**n)[2:].count('1')
%o print([a(n) for n in range(65)]) # _Michael S. Branicky_, May 22 2021
%o (PARI) vector(66, n, b=binary((n-1)^(n-1)); sum(j=1, #b, b[j])) /* _Joerg Arndt_, Jul 21 2012 */
%Y Cf. A000120, A159918, A079584.
%K nonn
%O 0,4
%A _Alex Ratushnyak_, Jul 21 2012
|