GATE / CS ARCHIVE

SIMILAR QUESTIONS / DISCRETE MATHEMATICS

Count integers divisible by none of three primes

2 questions solved the same way, newest first. Back to Discrete Mathematics

How these are solved

Both use the bounded positive-integer universe and exclude divisibility by exactly 2,3,5. Count single, pair and triple multiples using floors/LCMs, apply inclusion-exclusion, and subtract from the universe.

2 marks · NAT
Report issue

Probability & Random Variables

Question 48, GATE 2014: Choose an integer uniformly from 1 through 100 inclusive. What is the probability it is divisible by none of 2,3,5?
Tap to enlarge
Answer & solution

Official answer: 0.259 to 0.261

Our answer: 0.26

1. Set up the reasoning. Count the complement using inclusion-exclusion. Multiples of two or more divisors are counted repeatedly in the initial sum and must be corrected using their least common multiples.

2. Derive the result. Among1..100, counts divisible by 2, 3, 5 are 50, 33, 20. Pair intersections contribute 16, 10, 6 and the triple contributes 3. Their union has 50+33+20−16−10−6+3=74, leaving 26 integers. Under uniform selection the probability is 26/100=0.26, inside the official interval.

3. Check the interpretation. Use floor(100/d) for each divisor d. Subtract pair intersections for 6,10,15 and add back the triple intersection for 30, then subtract the union count from 100. The integer 1 is eligible and must not be excluded.

Original paper, page 42 · Answer key

Descriptive
Report issue

Counting integers coprime to30

Proof Techniques & Number Theory

Question 25(b), GATE 1995: How many positive integers at most 720 are divisible by none of 2,3,5?
Tap to enlarge
Answer & solution

Answer: 192. (no official key was published)

Let A,B,C be the subsets of {1,…,720} divisible by 2,3,5 respectively. Their sizes are 360,240,144. Because the divisors are pairwise coprime, the pair intersections count multiples of 6,10,15, giving 120,72,48; the triple intersection counts multiples of 30, giving 24.

Inclusion–exclusion gives |A∪B∪C|=360+240+144−120−72−48+24=528. These are exactly the integers disqualified by at least one divisibility condition. Subtract from all 720 positive integers to obtain 720−528=192. The subtraction of pair intersections corrects double counting, while adding the triple intersection restores numbers removed too many times.

An independent way to see the count is to use blocks of 30. In each block the allowed residue classes are 1,7,11,13,17,19,23,29 modulo 30, eight in total. There are 720/30=24 complete blocks, hence 24×8=192. The residue 0 is not allowed, and the positive-integer domain excludes 0 anyway.

Original paper, page 8