AMC 8 · 2025 · #23

Grade 5 number-theory
prime-numbersperfect-squaresprimality-testplace-value systematic-enumerationidentify-subproblems ↑ Prerequisites: prime-numbersprimality-testplace-value
📏 Medium solution 💡 3 insights
📘 View easy version →

Problem

How many four-digit numbers have all three of the following properties?

(I) The tens and ones digit are both 9.

(II) The number is 1 less than a perfect square.

(III) The number is the product of exactly two prime numbers.

Pick an answer.

(A)
0
(B)
1
(C)
2
(D)
3
(E)
4
View mode:

Toolkit + CCSS Solution

Understand

Restated: Count the four-digit whole numbers $N$ (from $1000$ to $9999$) that satisfy all three of: (I) the last two digits of $N$ are both $9$, (II) $N + 1$ is a perfect square, and (III) $N$ has exactly two prime factors when written as a product of primes.

Givens: $N$ is a four-digit number, so $1000 \le N \le 9999$; The tens digit and the ones digit of $N$ are both $9$ (so $N$ ends in $99$); $N = k^{2} - 1$ for some positive integer $k$; $N = p \times q$ where $p$ and $q$ are prime numbers (counted with multiplicity, $N$ has exactly two prime factors); Answer choices: (A) $0$, (B) $1$, (C) $2$, (D) $3$, (E) $4$

Unknowns: The number of four-digit integers $N$ that satisfy all three conditions

Understand

Restated: Count the four-digit whole numbers $N$ (from $1000$ to $9999$) that satisfy all three of: (I) the last two digits of $N$ are both $9$, (II) $N + 1$ is a perfect square, and (III) $N$ has exactly two prime factors when written as a product of primes.

Givens: $N$ is a four-digit number, so $1000 \le N \le 9999$; The tens digit and the ones digit of $N$ are both $9$ (so $N$ ends in $99$); $N = k^{2} - 1$ for some positive integer $k$; $N = p \times q$ where $p$ and $q$ are prime numbers (counted with multiplicity, $N$ has exactly two prime factors); Answer choices: (A) $0$, (B) $1$, (C) $2$, (D) $3$, (E) $4$

Plan

Primary tool: #2 Make a Systematic List

Secondary: #7 Identify Subproblems, #3 Eliminate Possibilities

Combining conditions (I) and (II) is a small subproblem: $N$ ends in $99$ means $N + 1 = k^{2}$ ends in $00$, which forces $k$ to be a multiple of $10$. That collapses the search from thousands of four-digit numbers down to a tiny finite list of $k$ values (Tool #7 splits the work cleanly). Tool #2 (Systematic List) then enumerates every candidate $k = 40, 50, \ldots, 100$ in order. For each, condition (III) is checked by noting $k^{2}-1 = (k-1)(k+1)$ — both factors must be prime — which is Tool #3 (Eliminate Possibilities) crossing off any $k$ where $k-1$ or $k+1$ is composite. No algebra needed beyond grade-school multiplication and primality checks.

Execute — Answer: B

#7 Identify Subproblems 5.NBT.A.2 Step 1
  • Combine conditions (I) and (II).
  • "Ends in $99$" means $N + 1$ ends in $00$, i.e., $N + 1$ is a multiple of $100$.
  • Since $N + 1 = k^{2}$, the perfect square $k^{2}$ must end in $00$.
  • The only way a square ends in $00$ is when the integer being squared ends in $0$, so $k$ must be a multiple of $10$.
$$N + 1 \equiv 00 \pmod{100} \;\Rightarrow\; k^{2}\text{ ends in }00 \;\Rightarrow\; k = 10m$$

💡 Patterns in trailing zeros of place value are a Grade 5 idea: a square ending in $00$ has to come from a number ending in $0$.

#2 Make a Systematic List 5.NBT.B.5 Step 2
  • Bound $k$ using the four-digit window.
  • We need $1000 \le N \le 9999$, which gives $1001 \le k^{2} \le 10000$.
  • Combined with $k = 10m$, the only candidates are $k = 40, 50, 60, 70, 80, 90, 100$ (since $30^{2}=900$ is too small and $110^{2}=12100$ is too big).
$$1001 \le k^{2} \le 10000,\; k=10m \;\Rightarrow\; k \in \{40, 50, 60, 70, 80, 90, 100\}$$

💡 Multi-digit multiplication ($40^{2}, 50^{2}, \ldots$) is a Grade 5 fluency standard, plenty to range-check the candidates.

#7 Identify Subproblems 4.OA.B.4 Step 3
  • Use the difference-of-squares factoring $k^{2} - 1 = (k-1)(k+1)$.
  • This is the key observation: $N$ is already the product of $k-1$ and $k+1$, so $N$ is a product of exactly two primes precisely when both $k-1$ and $k+1$ are themselves prime.
  • Any composite factor would introduce extra primes.
$$N = k^{2} - 1 = (k-1)(k+1)$$

💡 Verifying $(k-1)(k+1) = k^{2}-1$ is just multiplication, and "is it prime?" is the Grade 4 prime/composite skill.

#3 Eliminate Possibilities 4.OA.B.4 Step 4
  • Now run through the seven candidates and eliminate each one whose $k-1$ or $k+1$ is composite.
  • Only $k = 60$ survives because $59$ and $61$ are both prime (twin primes).
  • The corresponding $N = 59 \times 61 = 3599$.
$$\begin{aligned} k=40:&\;(39,41),\;39=3\cdot 13\;\text{X} \\ k=50:&\;(49,51),\;49=7^{2}\;\text{X} \\ k=60:&\;(59,61)\;\text{both prime}\;\checkmark \\ k=70:&\;(69,71),\;69=3\cdot 23\;\text{X} \\ k=80:&\;(79,81),\;81=3^{4}\;\text{X} \\ k=90:&\;(89,91),\;91=7\cdot 13\;\text{X} \\ k=100:&\;(99,101),\;99=9\cdot 11\;\text{X} \end{aligned}$$

💡 Testing each $k-1$ and $k+1$ for primality by trial division is exactly the Grade 4 "determine prime or composite" task.

#2 Make a Systematic List 4.OA.B.4 Step 5
  • Exactly one four-digit number, $N = 3599 = 59 \times 61$, satisfies all three conditions.
  • The count is $1$, which is choice (B).
$$\text{count} = 1 \;\Rightarrow\; \textbf{(B)}$$

💡 Tallying the surviving candidates from the systematic list is Grade 4 counting.

[1] #7 5.NBT.A.2 Combine conditions (I) and (II). "Ends in $99$" means $N + 1$ ends in $00$, i.e.
[2] #2 5.NBT.B.5 Bound $k$ using the four-digit window. We need $1000 \le N \le 9999$, which give
[3] #7 4.OA.B.4 Use the difference-of-squares factoring $k^{2} - 1 = (k-1)(k+1)$. This is the ke
[4] #3 4.OA.B.4 Now run through the seven candidates and eliminate each one whose $k-1$ or $k+1$
[5] #2 4.OA.B.4 Exactly one four-digit number, $N = 3599 = 59 \times 61$, satisfies all three co

Review

Reasonableness: Sanity check the winner: $3599$ ends in $99$ (condition I), $3599 + 1 = 3600 = 60^{2}$ is a perfect square (condition II), and $3599 = 59 \times 61$ with both factors prime, so exactly two prime factors (condition III). All three hold. Also, the answer of $1$ is consistent with how AMC 8 typically rewards twin-prime-style observations — twin primes thin out fast, so finding only one match in a small window is expected, not suspicious.

Alternative: Tool #5 (Look for a Pattern): instead of factoring $k^{2}-1$, you could compute each candidate $N$ directly ($1599, 2499, 3599, 4899, 6399, 8099, 9999$) and try to factor each by trial division up to $\sqrt{N} \approx 100$. This is slower and more arithmetic-heavy, but a student who hasn't yet noticed the $(k-1)(k+1)$ trick can still finish the problem with patience and a primality check.

CCSS standards used (min grade 5)

  • 5.NBT.A.2 Explain patterns in number of zeros and placement of decimal point (Recognizing that a perfect square ending in $00$ must come from an integer ending in $0$, so $k$ is a multiple of $10$.)
  • 5.NBT.B.5 Fluently multiply multi-digit whole numbers (Computing the squares $40^{2}, 50^{2}, \ldots, 100^{2}$ to confirm which values of $k$ keep $N = k^{2} - 1$ inside the four-digit window.)
  • 4.OA.B.4 Find all factor pairs and recognize multiples; determine prime or composite (Checking for each candidate $k$ whether $k-1$ and $k+1$ are prime (twin primes), since $N = (k-1)(k+1)$ is the product of exactly two primes iff both factors are prime.)

⭐ This AMC 8 problem only needs Grade 5 place-value patterns plus the Grade 4 "is this number prime?" check you already know!

⭐ This AMC 8 problem only needs Grade 5 place-value patterns plus the Grade 4 "is this number prime?" check you already know!