Lesson 2 of 6 · Mixed Problem Solving
Number Theory + Counting Hybrids
Divisors, multiples, and factorizations are countable sets — and once a number-theory question becomes "how many," every counting technique from that domain is available: inclusion-exclusion, casework, and direct listing when the set is small enough.
Mark your status for this lesson:
Learning objectives
- Count divisors, multiples, and factorizations using prime factorization.
- Apply inclusion-exclusion to divisibility conditions involving two or three numbers.
- Combine GCD and LCM with combinatorial reasoning about ordered pairs.
- Count subsets or integers satisfying a modular (remainder-based) condition.
The core idea
The divisor-count formula is the anchor for most of this lesson: if n = p₁^a × p₂^b × ..., then n has (a+1)(b+1)... positive divisors — each exponent contributes one more choice (0 through a) to a divisor's own factorization. This turns "how many divisors" into ordinary counting the moment the prime factorization is known.
Divisibility-by-multiple-numbers questions ("divisible by 3 or 5", "divisible by 3, 5, or 7") are inclusion-exclusion problems in disguise, with "multiple of k" playing the role of a set and "multiple of lcm(a,b)" playing the role of an intersection. And any problem asking to count integers, subsets, or pairs satisfying a number-theoretic condition — coprimality, a given GCD or LCM, a residue class — is fundamentally a counting problem that happens to be dressed in number-theory language.
Divisor-count formula
If n = p₁^a₁ × p₂^a₂ × ..., divisor count = (a₁+1)(a₂+1)...
Each exponent independently contributes a+1 choices (0 through a) to a divisor's own exponent on that prime — the total count is the product of these independent choices.
Inclusion-exclusion for divisibility
|A ∪ B| = |A| + |B| − |A ∩ B|
Where A and B are "multiples of a" and "multiples of b" — their intersection is exactly "multiples of lcm(a,b)."
Worked example 1 — Divisor count via factorization
Problem
How many positive divisors does 2000 have?
Key insight
Find the prime factorization first, then apply the divisor-count formula directly.
Solution
2000 = 2⁴ × 5³. Divisor count: (4+1)(3+1) = 20.
Takeaway
Listing all 20 divisors of 2000 by hand would take real effort and risk missing one — the formula gets the count instantly once the factorization is known.
Worked example 2 — Inclusion-exclusion with three divisibility conditions
Problem
How many integers from 1 to 100 are divisible by 2, 3, or 5?
Key insight
This is inclusion-exclusion across three sets — the same formula from the Counting & Probability domain, with "multiple of k" as each set.
Solution
Multiples of 2: 50. Of 3: 33. Of 5: 20. Of 6: 16. Of 10: 10. Of 15: 6. Of 30: 3. 50+33+20−16−10−6+3 = 74.
Takeaway
Every pairwise "and" condition (divisible by both 2 and 3, etc.) becomes "divisible by the LCM" — recognizing this translation is what turns a number-theory-flavored question into a standard inclusion-exclusion setup.
Worked example 3 — Counting pairs with a given GCD and LCM
Problem
How many ordered pairs (a, b) of positive integers satisfy gcd(a, b) = 4 and lcm(a, b) = 96?
Key insight
Write a = 4m and b = 4n where gcd(m, n) = 1 — the LCM condition becomes mn = 96/4 = 24, with m and n required to be coprime.
Solution
Coprime factor pairs of 24: (1,24) and (3,8) — each giving 2 ordered pairs (m,n) and (n,m). Total: 4 ordered pairs of (a,b).
Takeaway
The substitution a=dm, b=dn (where d is the GCD) is the standard way to turn a GCD/LCM counting problem into an ordinary coprime-factor-pair counting problem.
Worked example 4 — Counting by residue class
Problem
How many integers from 1 to 30 leave a remainder of 2 when divided by 5?
Key insight
These integers form an arithmetic sequence: 2, 7, 12, 17, 22, 27 — count the terms directly.
Solution
(27−2)/5 + 1 = 6 integers.
Takeaway
Counting integers in a residue class is really just counting terms of an arithmetic sequence — the same term-counting formula used throughout the Algebra Foundations domain applies directly.
Strategy notes
Translate "and" conditions to LCM before applying inclusion-exclusion
Whenever a divisibility problem involves "divisible by a and b," immediately rewrite it as "divisible by lcm(a,b)" — this is what makes the standard inclusion-exclusion formula directly applicable.
Use the substitution a=dm, b=dn for GCD/LCM counting problems
Writing both numbers as a common GCD times coprime factors turns a GCD/LCM condition into an ordinary coprime-pair-counting problem — one of the most reliable tools for this entire lesson.
Common mistakes
Forgetting the +1 in the divisor-count formula
Each exponent in the prime factorization contributes (exponent + 1) divisor choices, not just the exponent itself — dropping the +1 is an easy and common slip.
Using GCD instead of LCM (or vice versa) in inclusion-exclusion
The intersection of "multiples of a" and "multiples of b" is "multiples of lcm(a,b)," not gcd(a,b) — this mix-up silently produces a wrong intersection count.
Double-counting or missing symmetric ordered pairs
When counting ordered pairs (a,b), remember that (a,b) and (b,a) are usually distinct unless a=b — decide explicitly whether the problem wants ordered or unordered pairs before counting.
Practice
20 questions across four difficulty tiers, each with a single numeric answer. Up to three tries per question before the solution is shown.