Intermediate number theory problems (ages 13 to 16)
28 original competition-style problems: divisibility, primes, remainders and digits. Try each one before opening the hints; the second hint gives more away, and the full solution explains why the method works and where the idea leads.
For teachers: project, add to a worksheet or set as homework
Press Project on any problem to show it full screen with a timer, the hints, the answer and the worked solution one step at a time (arrow keys move between problems; Space reveals the next step; F full screen; Esc closes). Switch on the ‘Add to worksheet’ buttons, pick problems, then print them from the worksheet builder or set them as homework for a class, with the full solutions as the mark scheme. Free problems are free for every class; problems marked ‘With a plan’ can be set by teachers with a plan or school licence. Ready-made sessions: maths club packs.
For how many whole numbers n from 1 to 1000 does n2 end in the digits 21?
Hint
The last two digits of n2 depend only on the last two digits of n. Which last digits can n have?
Second hint
n must end in 1 or 9. Writing n = 10a + 1, n2 ≡ 20a + 1 (mod 100): when is that 21?
Full worked solution
Answer: 40
The last two digits of n2 depend only on the last two digits of n, so work with n = 10a + b, where b is the units digit and a the tens digit.
n2 ends in 1, so b2 ends in 1: b = 1 or b = 9.
b = 1: n2 = 100a2 + 20a + 1. Its tens digit is the units digit of 2a, which must be 2, so a ends in 1 or 6: n ends in 11 or 61.
b = 9: n2 = 100a2 + 180a + 81. Its tens digit is the units digit of 18a + 8, i.e. of 8a + 8, which must be 2, so 8a ends in 4: a ends in 3 or 8: n ends in 39 or 89.
So 4 numbers in every block of 100, and 1 to 1000 is 10 blocks: 4 × 10 = 40.
Why this works: Working modulo 100 means you only ever look at the last two digits. Expanding (10a + b)2 shows exactly which digit of n controls which digit of n2.
Where it leads: Solving n2 ≡ c modulo powers of 10 digit by digit is Hensel lifting, a key tool in number theory.
N has twelve 1s. Split it as 111111 followed by 111111: N = 111111 × 1000000 + 111111 = 111111 × 1000001.
Split 111111 the same way: 111111 = 111 × 1000 + 111 = 111 × 1001.
111 = 3 × 37 and 1001 = 7 × 11 × 13.
1000001 = 101 × 9901, and neither 101 nor 9901 has a prime factor below 100 (101 is prime; 9901 is prime).
So the prime factors of N below 100 are 3, 7, 11, 13 and 37. In particular 31 and 41 do not divide N.
The largest is 37 (D).
Why this works: Numbers made of repeated digits split along their pattern: a block of 1s of length ab is (block of length a) × (1 000…01 …). 1001 = 7 × 11 × 13 is a factorisation worth knowing.
Where it leads: Repunits (numbers made of 1s) factor according to the divisors of their length; Rn can only be prime when n is prime.
How many ordered pairs of positive whole numbers (a, b) satisfy ab = 2(a + b) + 20?
Hint
Move everything to one side and add 4 to both sides so the left side factorises.
Second hint
ab − 2a − 2b + 4 = 24, so (a − 2)(b − 2) = 24.
Full worked solution
Answer: 8
Rearrange ab = 2(a + b) + 20 as ab − 2a − 2b = 20.
Add 4 to both sides so the left factorises: ab − 2a − 2b + 4 = 24, i.e. (a − 2)(b − 2) = 24.
a and b are positive, so a − 2 ≥ −1 and b − 2 ≥ −1. Both brackets negative would need (−1)(−24), impossible, and one negative makes the product negative. So both brackets are positive.
Positive factor pairs of 24: 1 × 24, 2 × 12, 3 × 8, 4 × 6, and each in either order.
Check one: 6 × 8 = 48 and 2(6 + 8) + 20 = 48. ✓ There are 8 ordered pairs.
Why this works: Adding the right constant makes xy + px + qy factorise as (x + q)(y + p) − pq. Then a Diophantine equation becomes ‘list the factor pairs’.
Where it leads: Adding a constant to complete a product (Simon’s favourite factoring trick) turns many equations into divisor counts.
Powers of 3: 3, 2, 6, 4, 5, 1, so 36 ≡ 1 and the cycle has length 6.
100 = 6 × 16 + 4, so 3100 ≡ 34 = 81 = 77 + 4 ≡ 4.
Sum: 2 + 4 = 6, so the remainder is 6 (E).
Why this works: Once some power of a number leaves remainder 1, higher powers repeat in a cycle, so a huge exponent only matters through its remainder on dividing by the cycle length.
Where it leads: Fermat’s little theorem guarantees a6 ≡ 1 (mod 7) for every a not divisible by 7; the actual cycle may be shorter, like 3 for 2.
What is the smallest positive multiple of 15 that has exactly 15 positive divisors?
Hint
If n = paqb…, the number of divisors is (a+1)(b+1)…. How can 15 be written as a product?
Second hint
15 = 15 × 1 = 5 × 3, so n = p14 or p4q2. n must be divisible by 3 and 5.
Full worked solution
Answer: D, 2025
If n = pa qb … (prime factorisation), n has (a + 1)(b + 1)… divisors.
15 = 15 or 15 = 3 × 5, so n = p14 or n = p4 q2 for different primes p, q.
n is a multiple of 15, so both 3 and 5 divide n. That rules out p14 (one prime only) and forces {p, q} = {3, 5}.
The two options are 34 × 52 = 81 × 25 = 2025 and 32 × 54 = 9 × 625 = 5625.
The smaller is 2025 (D). (225 = 3252 is a trap: it has only 3 × 3 = 9 divisors.)
Why this works: The divisor-count formula turns ‘exactly k divisors’ into ‘write k as a product’. To make n small, give the largest powers to the smallest primes.
Where it leads: To make a number with a given number of divisors as small as possible, give the biggest exponents to the smallest primes.
How many three-digit numbers are equal to 19 times the sum of their digits?
Hint
Write the number as 100a + 10b + c and simplify 100a + 10b + c = 19(a + b + c).
Second hint
100a + 10b + c = 19a + 19b + 19c simplifies to 81a = 9b + 18c, i.e. 9a = b + 2c.
Full worked solution
Answer: 11
Write the number as 100a + 10b + c with a from 1 to 9 and b, c from 0 to 9.
The condition is 100a + 10b + c = 19(a + b + c) = 19a + 19b + 19c.
Rearrange: 81a = 9b + 18c, and divide by 9: 9a = b + 2c.
b + 2c is at most 9 + 18 = 27, so a is 1, 2 or 3.
a = 1: b + 2c = 9, with c = 0 to 4 (b = 9, 7, 5, 3, 1): 5 numbers (e.g. 190 = 19 × 10).
a = 2: b + 2c = 18, with c = 5 to 9 (b = 8, 6, 4, 2, 0): 5 numbers.
a = 3: b + 2c = 27 needs b = c = 9: 1 number, 399 = 19 × 21.
Total: 5 + 5 + 1 = 11.
Why this works: Digit problems collapse to small linear equations once the number is written in place-value form; bounding the digits keeps the case list short.
Where it leads: Digit equations become linear equations in a, b, c with small ranges, so a short search finishes them.
Why this works: Being a square or a cube is a condition on each prime’s exponent separately, so the problem splits into two small puzzles about remainders.
Where it leads: Combining conditions on exponents like this is the Chinese remainder theorem in action: a must be 3 mod 6.
100! means 1 × 2 × 3 × … × 100. What is the largest whole number k such that 3k divides 100!?
Hint
Count the multiples of 3 up to 100, then the multiples of 9, then 27, then 81.
Second hint
Each multiple of 9 contributes one extra factor 3 beyond the one already counted.
Full worked solution
Answer: 48
Multiples of 3 up to 100: ⌊100/3⌋ = 33, each giving one factor 3.
Multiples of 9: 11, each giving one extra 3.
Multiples of 27: 3 (27, 54, 81), one more each. Multiples of 81: 1, one more.
k = 33 + 11 + 3 + 1 = 48.
Why this works: Counting in layers (multiples of 3, then 9, then 27, …) counts each factor 3 exactly once.
Where it leads: This is Legendre’s formula. A neat consequence: the power of p in n! equals (n − digit sum of n in base p)/(p − 1). Check: 100 in base 3 is 10201, digit sum 4, (100 − 4)/2 = 48.
How many pairs of positive whole numbers (x, y) satisfy 3x + 5y = 100?
Hint
For which y is 100 − 5y a multiple of 3?
Second hint
100 leaves remainder 1 on division by 3, and 5y leaves the same remainder as 2y. So y leaves remainder 2.
Full worked solution
Answer: 6
We need 100 − 5y to be a positive multiple of 3.
Remainders on division by 3: 100 → 1 and 5y → 2y, so 2y must leave remainder 1, i.e. y leaves remainder 2: y = 2, 5, 8, 11, 14, 17, …
x > 0 needs 5y < 100, so y ≤ 19. That allows y = 2, 5, 8, 11, 14, 17.
Each gives a positive x (30, 25, 20, 15, 10, 5), so there are 6 pairs.
Why this works: One solution of a linear equation in whole numbers leads to all of them: here y steps by 3 while x steps by 5.
Where it leads: ax + by = c has whole-number solutions exactly when HCF(a, b) divides c. The steps between solutions are b/h and a/h, where h = HCF(a, b).
Two positive whole numbers have highest common factor 12 and product 5184. How many such pairs are there? (Count {a, b} and {b, a} as the same pair.)
Hint
Write the numbers as 12x and 12y. What do you know about x and y?
Second hint
xy = 5184 ÷ 144 = 36, and x and y have no common factor.
Full worked solution
Answer: 2
Write a = 12x and b = 12y, where x and y share no common factor (otherwise the HCF would be bigger).
ab = 144xy = 5184, so xy = 36.
Split 36 = 22 × 32 into two coprime parts: each prime power must go entirely to one side: {1, 36} and {4, 9}.
So the pairs are {12, 432} and {48, 108}: 2 pairs.
Why this works: Dividing out the HCF leaves two coprime numbers, and coprime numbers cannot share any prime, so each prime power goes to one side.
Where it leads: A number with k different prime factors splits into 2k−1 unordered coprime pairs. Coprime splitting is key in problems about squares and Pythagorean triples.
What is the smallest positive whole number whose square ends in the digits 444?
Hint
The square ends in 4, so the number ends in 2 or 8. Then think about the last two digits.
Second hint
Work out which endings give squares ending in 44. Then try to extend to 444.
Full worked solution
Answer: 38
A square ends in 4 only if the number ends in 2 or 8.
Squares ending in 44: checking endings 02, 08, 12, …, the numbers ending in 12, 38, 62, 88 work (e.g. 122 = 144, 382 = 1444).
Try the smallest candidates: 122 = 144 (ends 144, not 444); 382 = 1444 (ends 444). ✓
The answer is 38.
Why this works: Building the ending one digit at a time (last digit, then last two) cuts a big search down to a handful of candidates.
Where it leads: No square ends in 4444: squares ending in 44 have the form 100k + 44 with restrictions mod 16. Working modulo powers of 10 one digit at a time is called Hensel lifting.
How many perfect squares (including 1) divide 24 × 35 × 52?
Hint
A square factor has an even exponent for each prime.
Second hint
Exponent of 2: 0, 2 or 4. Of 3: 0, 2 or 4. Of 5: 0 or 2.
Full worked solution
Answer: 18
A factor 2a3b5c is a square exactly when a, b and c are all even.
a ∈ {0, 2, 4}: 3 choices. b ∈ {0, 2, 4} (b ≤ 5): 3 choices. c ∈ {0, 2}: 2 choices.
Total: 3 × 3 × 2 = 18.
Why this works: Squares are recognised prime by prime, so the choices for each exponent multiply.
Where it leads: The number of square factors of n equals the number of factors of the largest square dividing n’s ‘square root part’. Try counting cube factors the same way.
How many of the whole numbers 1, 2, 3, …, 99 can be written as the difference of two squares of whole numbers (a2 − b2, with 0 allowed)?
Hint
a2 − b2 = (a − b)(a + b). What can you say about the parity of the two brackets?
Second hint
a − b and a + b are both odd or both even. So the product is odd or a multiple of 4.
Full worked solution
Answer: D, 74
a2 − b2 = (a − b)(a + b), and the two brackets differ by 2b, so they are both odd or both even.
Both odd: the product is odd. Both even: the product is a multiple of 4. So numbers leaving remainder 2 on division by 4 are impossible.
Every other number works: odd n = 2k + 1 = (k + 1)2 − k2; n = 4k = (k + 1)2 − (k − 1)2.
From 1 to 99 there are 25 numbers of the form 4k + 2 (2, 6, …, 98), so 99 − 25 = 74 (D).
Why this works: Factorising a difference of squares and looking at parity both rules out a whole class and shows how to build every other number.
Where it leads: Sums of two squares are subtler: n is a sum of two squares exactly when every prime of the form 4k + 3 appears to an even power (Fermat and Euler).
What is the 2026th digit after the decimal point in the decimal expansion of 1/7?
Hint
1/7 = 0.142857142857…
Second hint
The block 142857 repeats every 6 digits. Divide 2026 by 6.
Full worked solution
Answer: 8
1/7 = 0.142857 repeating, with period 6.
2026 = 6 × 337 + 4, so the 2026th digit is the 4th digit of the block.
The block is 1, 4, 2, 8, 5, 7, so the 4th digit is 8.
Why this works: A repeating decimal is periodic, so only the remainder on division by the period matters.
Where it leads: 1/p has period dividing p − 1 for primes p other than 2 and 5. The period is p − 1 exactly when 10 is a ‘primitive root’ mod p (7, 17, 19, 23, …).
Why this works: Splitting off the whole-number part leaves a simple fraction whose denominator must divide its numerator. Remember negative divisors.
Where it leads: The same trick handles any (n + a)/(n + b): it is 1 + (a − b)/(n + b), so the number of solutions is controlled by the divisors of a − b.
p and q are prime numbers with p2 − 2q2 = 1. What is p + q?
Hint
Is p odd or even?
Second hint
p2 = 2q2 + 1 is odd, so p is odd. Then (p − 1)(p + 1) = 2q2.
Full worked solution
Answer: A, 5
p2 = 2q2 + 1 is odd, so p is odd, and p2 − 1 = (p − 1)(p + 1) is a product of two consecutive even numbers, so a multiple of 8.
So 2q2 is a multiple of 8, so q2 is a multiple of 4, so q is even: q = 2.
Then p2 = 9 and p = 3, which is prime.
p + q = 5 (A).
Why this works: Parity, pushed one step further (multiples of 8), forces q to be the only even prime.
Where it leads: Without the prime condition, x2 − 2y2 = 1 has infinitely many solutions (3, 2), (17, 12), (99, 70), …: Pell’s equation, whose solutions approximate √2.