MathLabs

Problem 2

Find the largest positive integer NN such that the number of integers in {1,2,…,N}\{1,2,\dots,N\} divisible by 33 equals the number of integers divisible by 55 or 77 (or both).
Step 2 of 6: Apply inclusion–exclusion
#{m≤N:5∣m or 7∣m}=⌊N5⌋+⌊N7⌋−⌊N35⌋.\#\{m\le N:5\mid m\text{ or }7\mid m\}=\left\lfloor\frac N5\right\rfloor+\left\lfloor\frac N7\right\rfloor-\left\lfloor\frac N{35}\right\rfloor.
Detailed analysis

Multiples of 35 are counted twice by the first two terms, so they must be subtracted once.