login
A279506
Total number of 1's in the binary expansion of A003418.
2
1, 1, 1, 2, 2, 4, 4, 4, 4, 6, 6, 6, 6, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 14, 14, 21, 21, 18, 18, 17, 17, 22, 22, 22, 22, 22, 22, 28, 28, 28, 28, 25, 25, 32, 32, 32, 32, 40, 40, 40, 40
OFFSET
0,4
LINKS
FORMULA
a(n) = A000120(A003418(n)). - Michel Marcus, Dec 23 2016
EXAMPLE
For n=10, the LCM of all the numbers from 1 to 10 is 2520 = 100111011000_2, which has a total of 6 1's, so a(10)=6.
MATHEMATICA
Map[DigitCount[#, 2, 1] &, FoldList[LCM, 1, Range@ 50]] (* Michael De Vlieger, Dec 13 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 1
x=bin(c(*range(1, n+1)))[2:]
return x.count("1")
for i in range(0, 10001):
print str(i)+" "+str(a(i))
(PARI) a(n) = hammingweight(lcm(vector(n, k, k))); \\ Michel Marcus, Dec 14 2016
CROSSREFS
Sequence in context: A076222 A177692 A098667 * A105678 A309195 A367026
KEYWORD
nonn,base
AUTHOR
Indranil Ghosh, Dec 13 2016
STATUS
approved