|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,4
|
|
LINKS
|
|
|
FORMULA
|
|
|
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
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|