%I #44 Mar 07 2023 20:11:02
%S 1,1,1,2,2,4,4,6,6,6,11,7,12,12,12,18,18,22,23,17,22,25,28,31,29,30,
%T 35,38,42,40,48,42,42,46,51,56,51,58,59,64,63,66,64,71,74,70,77,81,89,
%U 87,89,90,88,94,87,99,103,98,101,109,113,103,113,120,120,109,123,121,130,121
%N Number of ones in the binary expansion of n!.
%H Charles R Greathouse IV, <a href="/A079584/b079584.txt">Table of n, a(n) for n = 0..10000</a>
%H Florian Luca, <a href="http://dx.doi.org/10.4153/CMB-2002-013-9">The number of non-zero digits of n!</a>, Canad. Math. Bull. 45 (2002), pp. 115-118.
%H Carlo Sanna, <a href="http://arxiv.org/abs/1409.4912">On the sum of digits of the factorial</a>, arXiv:1409.4912 [math.NT], 2014.
%H Carlo Sanna, <a href="http://dx.doi.org/10.1016/j.jnt.2014.09.003">On the sum of digits of the factorial</a>, Journal of Number Theory 147 (2015), pp. 836-841.
%H <a href="/index/Fa#factorial">Index entries for sequences related to factorial numbers</a>
%F a(n) << n log n. - _Charles R Greathouse IV_, Mar 27 2013
%F a(n) = A000120(A000142(n)). - _Michel Marcus_, Sep 18 2014
%e a(5) = 4 because 5! = 120 and 120_10 = 1111000_2, with 4 ones.
%p seq(convert(convert(n!,base,2),`+`), n=0..1000); # _Robert Israel_, Sep 18 2014
%t Table[DigitCount[n!,2,1],{n,70}] (* _Harvey P. Dale_, Jul 10 2012 *)
%o (PARI) for(n=1,300,b=binary(n!); print1(sum(k=1,length(b),b[k])","))
%o (PARI) a(n)=hammingweight(n!) \\ _Charles R Greathouse IV_, Mar 27 2013
%o (Python)
%o import math
%o def a(n):
%o return bin(math.factorial(n))[2:].count("1") # _Indranil Ghosh_, Dec 23 2016
%Y Cf. A000120 (binary weight), A000142 (factorial), A004152 (sum of decimal digits).
%K nonn,base
%O 0,4
%A Jose R. Brox (tautocrona(AT)terra.es), Jan 26 2003
%E a(0)=1 prepended by _Alois P. Heinz_, Mar 07 2023
|