%I #18 Dec 23 2016 17:42:25
%S 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,
%T 18,18,17,17,22,22,22,22,22,22,28,28,28,28,25,25,32,32,32,32,40,40,40,
%U 40
%N Total number of 1's in the binary expansion of A003418.
%H Indranil Ghosh, <a href="/A279506/b279506.txt">Table of n, a(n) for n = 0..10000</a>
%F a(n) = A000120(A003418(n)). - _Michel Marcus_, Dec 23 2016
%e 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.
%t Map[DigitCount[#, 2, 1] &, FoldList[LCM, 1, Range@ 50]] (* _Michael De Vlieger_, Dec 13 2016 *)
%o (Python)
%o def gcd(a, b):
%o while b:
%o a, b = b, a % b
%o return a
%o def lcm(a, b):
%o return a * b // gcd(a, b)
%o def c(*ar):
%o return reduce(lcm, ar)
%o def a(n):
%o if n==0:
%o return 1
%o x=bin(c(*range(1,n+1)))[2:]
%o return x.count("1")
%o for i in range(0,10001):
%o print str(i)+" "+str(a(i))
%o (PARI) a(n) = hammingweight(lcm(vector(n, k, k))); \\ _Michel Marcus_, Dec 14 2016
%Y Cf. A000120, A003418.
%K nonn,base
%O 0,4
%A _Indranil Ghosh_, Dec 13 2016
|