cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A214561 Number of 1's in binary expansion of n^n.

This page as a plain text file.
%I A214561 #38 Oct 13 2022 14:57:43
%S A214561 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 A214561 41,68,37,62,51,83,1,79,61,88,58,97,85,98,53,115,96,116,63,123,96,128,
%U A214561 41,138,105,144,90,163,128,164,81,172,148,181,124,167,134,201,1
%N A214561 Number of 1's in binary expansion of n^n.
%C A214561 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 A214561 Alois P. Heinz, <a href="/A214561/b214561.txt">Table of n, a(n) for n = 0..16384</a>
%F A214561 a(n) = A000120(A000312(n)).
%F A214561 a(2^k)=1.
%p A214561 a:= proc(n) option remember; local m, r;
%p A214561       m, r:= n^n, 0;
%p A214561       while m>0 do r:= r +irem(m, 2, 'm') od; r
%p A214561     end:
%p A214561 seq(a(n), n=0..100);  # _Alois P. Heinz_, Jul 21 2012
%t A214561 Table[Count[IntegerDigits[n^n,2],1],{n,1,64}] (* _Geoffrey Critzer_, Sep 30 2013 *)
%t A214561 Join[{1},Table[DigitCount[n^n,2,1],{n,100}]] (* _Harvey P. Dale_, Oct 13 2022 *)
%o A214561 (Python)
%o A214561 for n in range(300):
%o A214561     c = 0
%o A214561     b = n**n
%o A214561     while b>0:
%o A214561         c += b&1
%o A214561         b//=2
%o A214561     print(c, end=',')
%o A214561 (Python)
%o A214561 def a(n): return bin(n**n)[2:].count('1')
%o A214561 print([a(n) for n in range(65)]) # _Michael S. Branicky_, May 22 2021
%o A214561 (PARI) vector(66, n, b=binary((n-1)^(n-1)); sum(j=1, #b, b[j])) /* _Joerg Arndt_, Jul 21 2012 */
%Y A214561 Cf. A000120, A159918, A079584.
%K A214561 nonn
%O A214561 0,4
%A A214561 _Alex Ratushnyak_, Jul 21 2012