OFFSET
0,5
LINKS
Indranil Ghosh, Table of n, a(n) for n = 0..10000
EXAMPLE
For n = 10, the LCM of all the numbers from 1 to 10 is 2520 = 100111011000_2, which has a total of 6 0's, so a(10) = 6.
MATHEMATICA
Map[DigitCount[#, 2, 0] &, {1}~Join~Table[LCM @@ Range@ n, {n, 61}]] (* Michael De Vlieger, Dec 16 2016 *)
PROG
(Python)
def gcd(a, b):
while b:
a, b = b, a % b
return a
def lcm(a, b):
return a * b // gcd(a, b)
def c(*ar):
return reduce(lcm, ar)
def a(n):
if n==0:
return 0
x=bin(c(*range(1, n+1)))[2:]
return x.count("0")
for i in range(0, 10001):
print str(i)+" "+str(a(i))
(PARI) a(n) = my(lcmn = lcm(vector(n, k, k))); #binary(lcmn) - hammingweight(lcmn); \\ Michel Marcus, Dec 23 2016
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Indranil Ghosh, Dec 13 2016
STATUS
approved