We need the sum of all n∈{1,2,…,100} such that gcd(n,2040)=1. First, factorize 2040=23×3×5×17. So n must not be divisible by 2, 3, 5, or 17.
We use inclusion-exclusion on the sum. Let Sd denote the sum of all multiples of d in {1,…,100}. If there are k=⌊100/d⌋ such multiples, then Sd=d⋅2k(k+1).
The sum we want is Stotal−(S2+S3+S5+S17)+(S6+S10+S34+S15+S51+S85)−(S30+S102+S170+S255)+S510, where terms with d>100 contribute zero.
Computing each: the total sum is 2100×101=5050. For S2: k=50, S2=2×1275=2550. For S3: k=33, S3=3×561=1683. For S5: k=20, S5=5×210=1050. For S17: k=5, S17=17×15=255.
For the pairwise terms: S6: k=16, S6=6×136=816. S10: k=10, S10=10×55=550. S34: k=2, S34=34×3=102. S15: k=6, S15=15×21=315. S51: k=1, S51=51. S85: k=1, S85=85.
For the triple terms: S30: k=3, S30=30×6=180. S102, S170, S255 all have k=0, contributing nothing. The quadruple term S510=0 as well.
Putting it all together: 5050−(2550+1683+1050+255)+(816+550+102+315+51+85)−180=5050−5538+1919−180=1251.