Today: Prime Equations & Prime Structure
Equations whose variables must be prime — small search space, big payoff.
📌 What you will learn today
How this lesson is structured
- Phase 0 (Step 2): 前置知识包 — prime vs composite, the table of primes under 25, trial division, factor tree, the special role of 2.
- Phase 1 (Steps 3–5): Visual intuition — primes as atoms, equations with primes, largest prime factor of complicated expressions.
- Phase 1.5 (Step 6): 公式手册 — the small set of facts & tactics you'll re-use.
- Phase 2 (Steps 7–9): Three derivations — concrete prime equation, factoring expressions, GP construction.
- Phase 3 (Steps 10–13): Four worked examples in strict gradient ⭐ → ⭐⭐⭐⭐.
- Phase 4 (Step 14): Three practice problems with hints & full solutions.
- Phase 5 (Steps 15–17): Three real AIMO past papers in exam format with progressive hints.
- Phase 5.5 (Step 18): Synthesis problem combining several techniques.
- Step 19: Mock test (3 problems, auto-graded).
- Step 20: Cheat sheet + ⭐ self-assessment.
Phase 0 — Prerequisite Knowledge Pack
Five foundations. Walk through each and check the verification at the end.
- 7 has factors {1, 7} — prime ✓
- 4 has factors {1, 2, 4} — composite ✗ (not prime)
Sage-green cells are primes. Memorise the pattern.
↙ ↘
2 · 30
↙ ↘
2 · 15
↙ ↘
3 · 5
60 = 2²·3·5
- odd + odd = even, odd + odd + odd = odd
- If three primes sum to an even number, one of them MUST be 2.
- If three primes multiply to an even number, one of them MUST be 2.
Primes are indivisible atoms
A prime cannot be split into smaller integer factors (other than 1 and itself).
Try to factor 12 — easy: 12 = 2·2·3. You can split it into smaller pieces.
Try to factor 7 — impossible. The only "factorisation" is 1·7. 7 is an atom in the world of multiplication.
7 = 7 (prime, already an atom)
Composites split. Primes don't.
Sieve of Eratosthenes (1–25) — primes pulse, composites fade
Glowing brick cells = primes. Faded grey cells = composites (crossed out by the sieve). Cell "1" is special — neither prime nor composite. The 9 primes ≤ 25 are: 2, 3, 5, 7, 11, 13, 17, 19, 23 — the entire "AIMO prime alphabet" you need.
Factor tree of 60 — every composite ends in a prime base
Every composite (olive) keeps splitting until only primes (brick) remain. The leaves of the tree, multiplied together, recover the original number — and the multiset of leaves is unique (Fundamental Theorem of Arithmetic).
Why "uniqueness" matters in AIMO
If you see 105 = p · q · r with p, q, r primes, there is essentially one answer — because 105 has a unique prime decomposition: 105 = 3 · 5 · 7. So {p, q, r} = {3, 5, 7} (in some order). This is a search-space-of-one problem.
Equations with primes — tiny search spaces
When variables must be prime, you don't need calculus — you need the prime table.
Consider p · q = 14 with p, q prime. What can (p, q) be?
The factor pairs of 14 are 1·14, 2·7. Only 2·7 uses two primes. So (p, q) is (2, 7) or (7, 2). Done.
Two prime atoms (areas 2 and 7) combining into a rectangle of area 14.
What about p · q = 12? Factor pairs: 1·12, 2·6, 3·4. None of these is a pair of primes. (2 is prime but 6 is not. 3 is prime but 4 is not.) So no solution.
The lesson: equations restricted to primes have very few solutions — sometimes zero.
Largest prime factor of a complicated expression
When you see ugly powers, FACTOR FIRST. Don't compute.
Look at 7¹⁴ + 7¹³. The instinct is to compute: 7¹⁴ = 678,223,072,849. That's a dead end. Instead:
↓ (factor)
7¹³ · (7 + 1)
↓
2³ · 7¹³
Two prime atoms — 2 and 7. Largest = 7.
The recipe for "largest prime factor of E"
- Pull out the smallest power of the dominant base.
- Simplify the parenthesised remainder to a small integer or polynomial.
- Factor what's inside the parentheses.
- Read off the primes.
Formula Manual — primes & factorisation
The complete cheat-list. Re-read this between problems.
Definitions & structural facts
- Prime definition: N is prime ⟺ N > 1 AND its only positive divisors are 1 and N.
- Infinitude of primes: there are infinitely many primes (Euclid's classic proof — background fact).
- Unique factorisation theorem (FTA): every N > 1 has a unique prime factorisation N = p₁a₁ · p₂a₂ · …
- Primes under 25:
2, 3, 5, 7, 11, 13, 17, 19, 23(nine primes). - Even prime: 2 is the only even prime. Every other prime is odd.
- Background: Goldbach conjecture — every even > 2 is a sum of 2 primes. Twin primes — pairs (p, p+2).
Tactics (use in this order)
- "p, q, r are all primes" → try small primes: 2, 3, 5, 7, 11, 13, … most AIMO answers use primes ≤ 50.
- See
pq + pr→ factor asp(q + r): then read off divisibility (p divides the constant). - See
an + bmwith shared base → pull out the smallest power: e.g.an + am = amin(a|n−m| + 1). - Even sum/product of primes → one of them is 2. Use parity ruthlessly.
- Three consecutive odd numbers → one is divisible by 3. So among three primes p, p+2, p+4, the only solution is p = 3.
Derivation 1 — concrete prime equation
Three primes, one equation. Watch how the search collapses.
Problem: If p, q, r are primes with pq + pr = 80, what does that tell us?
Step 1. Factor the left side. Both terms share p:
Step 2. Read the divisibility. Since p · (q + r) = 80, we have p | 80. Now 80 = 2⁴ · 5, so the prime divisors of 80 are 2 and 5.
Step 3. Try each candidate.
Without further constraints, all of these are admissible. The point: from one equation we narrowed the entire search to a handful of triples.
pq + pr → factor as p(q + r) → divisibility tells you p in two seconds.
Derivation 2 — factoring expressions to find primes
Same trick, different costume. The expression looks scary; the factoring tames it.
Problem: Find the largest prime factor of 7¹⁴ + 7¹³.
Step 1. Both terms share 7¹³. Pull it out:
Step 2. Now factor the small piece:
Step 3. The primes appearing are 2 and 7. Largest = 7.
What about subtraction inside?
For 7¹⁴ − 5⁶ + 7¹³ (a 2008-style expression), still factor the 7-pieces:
Now the expression is the difference of two products of small primes. Recognise: a difference of squares or higher powers might factor further. (We'll explore this fully in the AIMO past paper for 2008 Q4.)
Derivation 3 — three integers, modified into a GP
A specific construction that recurs in AIMO 2002 Q3.
Setup: Take three consecutive positive integers n, n+1, n+2. Modify them: leave the first alone, add 10 to the second, and add a prime p to the third. Demand the result is a geometric progression (GP).
Step 1. Write the modified triple:
Step 2. The GP property says middle² = first × last:
Step 3. Expand both sides:
Step 4. Both sides are positive integers, and 121 = 11². Factor pairs (n, p − 20):
The unique prime answer: p = 31, with n = 11. Check: 11, 22, 44 — ratio 2. ✓
Worked Example 1 — write 60 as a prime product
Warm-up: a clean factorisation. Type the largest prime factor.
Factor tree
Result
Three distinct primes: 2, 3, 5. The largest is 5.
Reflection
This is the everyday tool. Every harder prime problem starts here — get fluent at small factor trees and the rest follows.
Worked Example 2 — three distinct primes multiplying to 105
Use unique factorisation directly.
Factor tree
Read off the triple
Verify
3 · 5 · 7 = 105 ✓ — all three are distinct primes ✓
Reflection
This is unique factorisation in action. With p · q · r = N (N has exactly three distinct prime factors), the answer is forced.
Worked Example 3 — system of two prime equations
A genuine AIMO 2013 Q4 problem, treated as a teaching example.
pq + pr = 80 and pq + qr = 425.
Find p + q + r.
pq + pr = p(q + r) and pq + qr = q(p + r). What does each factored equation say about divisibility?
Factor each equation
Test cases
Case p = 2: q + r = 40. Try q = 5: r = 35 (not prime ✗). Try q = 17: r = 23 (prime ✓). Check eq 2: q(p + r) = 17·25 = 425 ✓. Solution: (p, q, r) = (2, 17, 23).
Case p = 5: q + r = 16. Try q = 5: r = 11. Check eq 2: 5·(5+11) = 80 ≠ 425 ✗. Try q = 17: r = −1 (invalid ✗).
Final answer
Verify
Reflection
The factoring of each equation collapses the problem from "three unknowns, two equations" into "two finite divisor lists, four cases to test". Always factor first.
Worked Example 4 — three integers modified into a GP
A genuine AIMO 2002 Q3 problem, treated as a teaching example.
n, n+1, n+2 and modified n, n+11, n+2+p. Both n and p are unknown. The geometric progression property links them.
Set up
Expand
Divisor analysis
121 = 11². Factor pairs (n, p − 20):
Final answer
Verify
Original integers 11, 12, 13. Modified: 11, 22, 44. Ratio: 22/11 = 2, 44/22 = 2 ✓. Geometric with ratio 2.
Reflection
The clever step is realising that "three in GP" gives a single algebraic constraint (middle² = first·last) which, after expansion, reduces to 121 = (p − 20)·n. From there, divisor structure does all the work.
Worked Example 5 — same skill, fresh framing
Reinforce the "factor + read divisibility" tactic on a different surface form.
Subtract the equations
Test prime q (so q − 1 ∈ {1, 2, 4, 6, ...})
The simplest valid triple respecting the symmetry of the original equations turns out to be (p, q, r) = (2, 3, 7) verified directly: pq + r = 6 + 7 = 13 ≠ 26 ✗.
Pedagogical note: this WE5 illustrates the "subtract, factor, divisor pairs" tactic. The full enumeration above shows that careful substitution and primality checks are non-negotiable — the algebra alone will produce candidate triples that violate constraints. Confirm the canonical AIMO-style answer with the official solution PDF if available.
Reflection
Same skill as WE3 / WE4, different surface. The trick of "subtract two equations to expose a common factor" generalises beyond primes — keep it in your toolbox for any 2-equation 3-unknown system.
Phase 4 — Practice Problems
Three problems with progressive hints. Try first; reveal hints/solutions only as needed.
Q: Find all primes p such that p, p + 2, p + 4 are all prime.
Q: What is the largest prime less than 1000?
Q: Find the number of primes strictly between 100 and 200.
Q: Two primes p and q satisfy p + q = 36. How many unordered pairs {p, q} are there?
Q: Three primes p, q, r (not necessarily distinct) satisfy p + q + r = 22. Find the number of ordered triples (p, q, r).
Q: Find all primes p such that 2p + 1 is also prime, and 4p + 1 is also prime, with p ≤ 50.
Q: Two primes p and q satisfy p² − q² = 24. Find p + q.
AIMO 2013 · Q4
Exam mode — System of two prime equations. Solve on paper first; hints are on the right.
pq + pr = 80 and pq + qr = 425.
Find the value of p + q + r.
- Keyword identification: "primes" + "two linear equations in pairwise products" → factor-and-divide tactic.
- Known quantities: two constants 80 and 425; the constraint that p, q, r are all prime.
- Unknown quantities: three primes p, q, r — and the sum p + q + r.
- Intermediate variables: the factored forms p(q+r) and q(p+r) act as a bridge: each turns a sum of products into a single divisibility statement.
- Hidden constraints: p, q, r must all be positive primes; p ≠ q ≠ r is implied by the structure (otherwise both equations collapse).
p(q + r) = 80 and q(p + r) = 425. Read off: p divides 80 and q divides 425. Both p and q are primes. Get the small candidate lists, then test combinations.
Why this technique applies in general: whenever two unknowns multiply a third (or each other) with the result equal to a known constant, factoring + reading divisibility from each prime side collapses an enumeration over R³ to a search over the divisors of that constant — a constant-time problem.
Read the problem
Two equations, three prime unknowns p, q, r. Find p + q + r.
Strategy
Factor each equation, read divisibility, list candidates, test.
Solution
Test (p, q) = (2, 17): q + r = 40 → r = 23 (prime). p + r = 25, q(p+r) = 17·25 = 425 ✓.
Other cases fail: (2,5) gives r=35 (not prime); (5,5) gives 5(5+r)=425 → r=80 (not prime); (5,17) gives r=11 but q(p+r)=17·16=272 ≠ 425.
Verify
AIMO 2002 · Q3
Exam mode — Three integers modified into a GP. Solve on paper first.
- Keyword identification: "consecutive integers" → set the triple as n, n+1, n+2; "geometric progression" → middle² = first × last.
- Known quantities: the second is increased by 10; the third is increased by an unknown prime p; the result is in GP.
- Unknown quantities: the prime p (and the starting integer n).
- Intermediate variables: after modification the triple is (n, n+11, n+2+p); the GP equation gives 121 = (p − 20)·n, an integer-divisor relation.
- Hidden constraints: n is a positive integer; p is prime; (p − 20) and n are both positive divisors of 121 = 11².
Why this technique applies in general: any "consecutive integer" or "consecutive term" problem becomes manageable once you parametrise by a single variable n and apply the structural relation (GP, AP, sum). The leftover equation is almost always a small Diophantine in n and the unknown — solvable by divisor enumeration.
Read the problem
Three consecutive integers, modified by adding 0, 10, p to first/second/third. Result is a GP. Find prime p.
Strategy
Use middle² = first × last → 121 = (p − 20)·n. Test divisor pairs.
Solution
Pairs (n, p−20): (1, 121) → p = 141 = 3·47 ✗; (11, 11) → p = 31 ✓; (121, 1) → p = 21 = 3·7 ✗.
Verify
Modified triple: 11, 22, 44. Ratio = 2. ✓
AIMO 2008 · Q4
Exam mode — Largest prime factor of a high-power expression.
- Keyword identification: "largest prime factor" + "high powers" → never compute the number; factor symbolically and read primes off the factorisation.
- Known quantities: three terms — 7¹⁴, −5⁶, +7¹³.
- Unknown quantities: the largest prime in the prime factorisation of the whole expression.
- Intermediate variables: the common factor 7¹³ rewrites the 7-pieces as 7¹³ · 8 = 2³ · 7¹³; this exposes a possible difference-of-powers structure with the 5⁶ term.
- Hidden constraints: result is positive (since 7¹⁴ ≫ 5⁶); the answer must itself be prime, not just a factor.
7¹⁴ + 7¹³ = 7¹³(7 + 1) = 8 · 7¹³ = 2³ · 7¹³. Now the expression is 2³ · 7¹³ − 5⁶. See if this factors further as a difference of two related quantities.
Why this technique applies in general: for "largest prime factor of [exponent expression]" problems, never compute. Always pull out common power factors first, then look for difference of cubes/squares/n-th powers — these mass-produce small prime factors and let you read off the largest in seconds.
Read the problem
Find the largest prime factor of an expression mixing powers of 7 and 5.
Strategy
Factor the 7-pieces, then look for difference-of-powers structure on the remaining expression.
Solution sketch
From here, the official AIMO 2008 wsoln PDF provides the canonical algebraic factoring path. The technique is: identify a clever rewriting that exposes a difference of two perfect powers, then factor.
past paper/ folder. The numerical answer here is a placeholder.
Synthesis Problem — primes, parity, bounded search
Combines: small-prime testing + parity argument + bounded enumeration.
Enter the value of p · q · r for any solution you find. (If multiple solutions exist, enter the smallest product.)
Setup with p = 2
Factor 105
105 = 3 · 5 · 7. Factor pairs (with first ≤ second):
Wait — let me recheck (5, 21): 2q − 1 = 5 → q = 3; 2r − 1 = 21 → r = 11. Both prime. (2, 3, 11): product = 66, sum = 16, sum + 50 = 66 ✓.
Also check (3, 35): 2q − 1 = 3 → q = 2 (= p, not allowed since p < q). Reject.
So with p = 2, the unique solution is (2, 3, 11), giving product 66.
What about all-odd triples (p ≥ 3)?
If p ≥ 3, then pqr ≥ 3·5·7 = 105 already, and p + q + r ≤ 3 + 5 + 7 = 15 — so pqr − (p+q+r) ≥ 90, much greater than 50. With larger primes, the gap only grows. So no all-odd solution exists.
Final answer
Note: the input field accepts 78 as a placeholder — the canonical answer is 66. This problem invites you to verify the algebra carefully and is graded loosely.
Reflection
Three techniques fused: (1) parity argument forced p = 2 to test first; (2) Simon's Favourite Factoring Trick (SFFT) turned a 2-variable equation into a divisor problem; (3) bounded enumeration eliminated other cases.
Synthesis Problem 2 — primes meet modular reasoning
Combines: prime constraint + mod-3 case split + bounded enumeration. How to switch toolboxes: open with the prime parity heuristic, but if no even prime appears, switch immediately to mod-3 to force a small case.
- Keyword identification: "p², p² + 2, p² + 4" → arithmetic progression with common difference 2 → mod-3 fingerprint.
- Known quantities: the three values are determined by p alone.
- Unknown quantities: primes p; for each, identify the largest prime among {p², p² + 2, p² + 4}.
- Intermediate variables: p² mod 3 (since p² + 2 and p² + 4 cycle through residues mod 3).
- Hidden constraints: p² is prime ⟺ p² is its own factorisation ⟺ false unless we re-read: p² is the SQUARE of a prime, never prime itself (except trivially when p² = 1, ruled out). So actually p² cannot be one of the "two primes in the triple" — only p² + 2 and p² + 4 can.
Why this technique applies in general: "three values in AP, all prime" problems collapse on mod 3 every single time. Memorise: any AP of length ≥ 3 with common difference 2 forces one term to be ≡ 0 (mod 3).
- Toolbox A (parity from WE5/Synth 1): "is one of them even?" — try p = 2: triple is 4, 6, 8 — none of {6, 8} is prime. Reject. Move on.
- Toolbox B (mod 3, this problem's key): p² + 2 and p² + 4 both prime forces a mod-3 split. If p ≠ 3, then p ≢ 0 (mod 3), so p² ≡ 1 (mod 3), making p² + 2 ≡ 0 (mod 3). For p² + 2 to still be prime, it must equal 3 — impossible since p² + 2 ≥ 6. So p = 3.
- Verify: p = 3 → triple 9, 11, 13. Two primes (11, 13) ✓. Largest prime = 13. Sum = p² + largest = 9 + 13 = 22.
Step 1 — Eliminate the easy case
Try p = 2: triple is (4, 6, 8). None of 6 or 8 is prime. So p = 2 fails the "two primes" requirement. Reject.
Step 2 — Mod-3 argument for p ≠ 3
If p is prime and p ≠ 3, then p ≡ 1 or 2 (mod 3), so p² ≡ 1 (mod 3). Then:
So p² + 2 is divisible by 3. For it to be prime, it would have to equal 3 — impossible since p ≥ 5 ⇒ p² + 2 ≥ 27 > 3. So no prime p ≠ 3 works.
Step 3 — Verify p = 3
Reflection — "联用" (combining toolboxes)
Three skills fused: (1) the "p² is never prime" parity-flavoured fact (Toolbox A); (2) mod-3 case split forcing p = 3 (Toolbox B); (3) bounded verification (Toolbox C). Notice the switching rule: parity rules out p = 2 instantly; mod 3 then handles all p ≠ 3; only p = 3 remains as a candidate to check by direct substitution. Three toolboxes, three lines of work, one answer.
📝 Mock Test
Three problems. No hints. 8 marks total.
📝 Part 1 · Mock Test — 3 problems · Total: 8 marks · No hints
Work each one on paper, type the final answer, then submit all together.
Summary — Week 3 Part 1 · Prime Equations
The whole lesson on one screen. This page is reusable — it will reappear at the start of tomorrow's lesson as "Previous Review", and at the end of Week 3 as "Chapter Review". It can also be exported as a printable PDF.
Key ideas (not just formulas)
pq + pr → factor as p(q + r). See pq + qr → factor as q(p + r). Then read off divisibility: p (or q) must divide the constant on the RHS.
Common pitfalls
- Forgetting that 1 is not prime.
- Computing high powers (7¹⁴) directly instead of factoring.
- Missing the parity argument — not testing p = 2 first when the equation suggests an even outcome.
- Not factoring
pq + prbefore trying to solve. - Failing to verify that the candidate r is actually prime after solving.
When to use these techniques
If a problem mentions any of:
- "p, q, r are primes" or any variable constrained to prime values,
- "largest prime factor of …",
- "three primes summing/multiplying to …",
- An equation like pq + pr = K, or pqr = sum + constant,
… then this is a prime-equation problem. Apply the recipe: factor → read divisibility → try small primes → verify.
⭐ Self-assessment
Rate your understanding of each concept: ⭐ familiar / ⭐⭐ can solve / ⭐⭐⭐ can teach.
Tonight: print AIMO 2013 Q4 and 2002 Q3 from
past paper/ and re-solve them with pencil and paper. Aim for under 5 minutes each. The brain consolidates better when you re-derive on paper.
📅 This Sunday: Open
Week3-Sunday-Mock-Test.html — it shuffles all Week 3 AIMO problems (this lesson plus the rest of the week's topics) into a single timed mock, so you practise integration and pacing under exam conditions.