OFFSET
0,4
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 0..10000
Florian Luca, The number of non-zero digits of n!, Canad. Math. Bull. 45 (2002), pp. 115-118.
Carlo Sanna, On the sum of digits of the factorial, arXiv:1409.4912 [math.NT], 2014.
Carlo Sanna, On the sum of digits of the factorial, Journal of Number Theory 147 (2015), pp. 836-841.
FORMULA
a(n) << n log n. - Charles R Greathouse IV, Mar 27 2013
EXAMPLE
a(5) = 4 because 5! = 120 and 120_10 = 1111000_2, with 4 ones.
MAPLE
seq(convert(convert(n!, base, 2), `+`), n=0..1000); # Robert Israel, Sep 18 2014
MATHEMATICA
Table[DigitCount[n!, 2, 1], {n, 70}] (* Harvey P. Dale, Jul 10 2012 *)
PROG
(PARI) for(n=1, 300, b=binary(n!); print1(sum(k=1, length(b), b[k])", "))
(PARI) a(n)=hammingweight(n!) \\ Charles R Greathouse IV, Mar 27 2013
(Python)
import math
def a(n):
return bin(math.factorial(n))[2:].count("1") # Indranil Ghosh, Dec 23 2016
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Jose R. Brox (tautocrona(AT)terra.es), Jan 26 2003
EXTENSIONS
a(0)=1 prepended by Alois P. Heinz, Mar 07 2023
STATUS
approved