QlarIITy

MathematicsJEE Main 2021 · 22 JulyInteger

The sum of all the elements in the set {n∈{1,2,…,100}∣H.C.F.\{n \in \{1, 2, \ldots, 100\} \mid H.C.F. of nn and 2040 is 1}1\} is equal to _________.

Try it before you look.The full solution is on this page, below the answer box, the moment you check. No sign-in needed.

Solution

Core idea. Numbers free of several primes are found by inclusion and exclusion on the multiples.

Concept refresher. The sum of the multiples of kk up to a given bound, when there are mm of them, is

S=k×m(m+1)2S = k \times \dfrac{m(m + 1)}{2}

Picture the situation. Since 2040=23×3×5×172040 = 2^3 \times 3 \times 5 \times 17, a number has highest common factor 1 with 2040 when it is not divisible by 2, 3, 5 or 17. The primes 2, 3 and 5 are handled together by inclusion and exclusion on the sums of their multiples. The prime 17 has very few multiples up to 100 and is handled at the end.

Approach. Apply inclusion and exclusion to the sums of multiples of 2, 3 and 5, then remove the multiples of 17 that remain.

  1. Step 1: Sums of multiples

    Up to 100 the numbers add to 5050. The multiples of 2, 3 and 5 add to 2550, 1683 and 1050; those of 6, 10 and 15 add to 816, 550 and 315; and those of 30 add to 180.

  2. Step 2: No factor 2, 3 or 5

    By inclusion and exclusion the numbers divisible by 2, 3 or 5 add to 5283−1681+180=37825283 - 1681 + 180 = 3782, so the others add to 5050−3782=12685050 - 3782 = 1268.

  3. Step 3: Remove multiples of 17

    Of the multiples of 17 up to 100, namely 17, 34, 51, 68 and 85, only 17 has no factor 2, 3 or 5. So the required sum is 1268−17=12511268 - 17 = 1251.

Answer. 1251

Sanity check. Up to 30 the numbers with no factor 2, 3 or 5 are 1, 7, 11, 13, 17, 19, 23, 29; the pattern repeats every 30, giving 26 such numbers up to 100, and 26 numbers averaging about 49 add to about 1268.

Common wrong answers

  • 1268: Forgetting the prime factor 17 of 2040 gives 1268.
  • 1013: Removing all five multiples of 17, which add to 255, gives 1013; four of them had already been removed.

Key takeaway

The trap. Every prime factor of the given number must be excluded, however large.

How toppers think. They treat the small primes together and the large prime by a short list.

Remember. S=k×m(m+1)2S = k \times \dfrac{m(m + 1)}{2}

More on Inclusion–Exclusion Principle