login
A279515
Number of 0's in the binary expansion of the least common multiple of the first n integers.
1
0, 0, 1, 1, 2, 2, 2, 5, 6, 6, 6, 9, 9, 7, 7, 7, 8, 12, 12, 16, 16, 16, 16, 19, 19, 14, 14, 19, 19, 25, 25, 25, 26, 26, 26, 26, 26, 25, 25, 25, 25, 33, 33, 32, 32, 32, 32, 29, 29, 32, 32, 32, 32, 35, 35, 35, 35, 35, 35, 46, 46, 45
OFFSET
0,5
LINKS
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
Sequence in context: A097006 A033306 A136347 * A260338 A023569 A263373
KEYWORD
nonn,base
AUTHOR
Indranil Ghosh, Dec 13 2016
STATUS
approved