A214561 Number of 1's in binary expansion of n^n.
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, 41, 68, 37, 62, 51, 83, 1, 79, 61, 88, 58, 97, 85, 98, 53, 115, 96, 116, 63, 123, 96, 128, 41, 138, 105, 144, 90, 163, 128, 164, 81, 172, 148, 181, 124, 167, 134, 201, 1
Offset: 0
Keywords
Links
- Alois P. Heinz, Table of n, a(n) for n = 0..16384
Programs
-
Maple
a:= proc(n) option remember; local m, r; m, r:= n^n, 0; while m>0 do r:= r +irem(m, 2, 'm') od; r end: seq(a(n), n=0..100); # Alois P. Heinz, Jul 21 2012
-
Mathematica
Table[Count[IntegerDigits[n^n,2],1],{n,1,64}] (* Geoffrey Critzer, Sep 30 2013 *) Join[{1},Table[DigitCount[n^n,2,1],{n,100}]] (* Harvey P. Dale, Oct 13 2022 *)
-
PARI
vector(66, n, b=binary((n-1)^(n-1)); sum(j=1, #b, b[j])) /* Joerg Arndt, Jul 21 2012 */
-
Python
for n in range(300): c = 0 b = n**n while b>0: c += b&1 b//=2 print(c, end=',')
-
Python
def a(n): return bin(n**n)[2:].count('1') print([a(n) for n in range(65)]) # Michael S. Branicky, May 22 2021
Comments