The prime factorisation of the given number is 2040=23×3×5×17
The H.C.F. of n and 2040 is 1 if n is not a multiple of 2,3,5 and 17.
Hence n cannot be multiple of 2,3,5 and 17
Then sum is n(1)−(n(2)+n(3)+n(5)+n(17)−n(6)−n(10)−n(34)−n(15)−n(51)−n(85))+n(30))
Where n(a) means the sum of all numbers belonging to the set 1,2,…….100 which are divisible by a
=2100×101−(22×50×51+23×33×34+25×20×21+217×5×6−26×16×17−210×10×11−234×2×3−215×6×7−51−85+180)
=5050−2550−1683−1050−255+816+550+102+315+51+85−180
=1251
Alternate Solution:
Thus, the sum of all the required numbers taking the common elements only once, is (1+3+5+…..+99)−(3+9+15+21+……+99)−(5+25+35+55+65+85+95)−(17)
Now, using the sum of n terms of an arithmetic progression i.e. Sn=2n[a+l], where a is the first term and l is the last term.
=250[1+99]−217[3+99]−(365)−17
=250(100)−217(102)−365−17
=2500−867−365−17
=1251.