2005 AIME I Problem 12

Attempt Problem 12 of the 2005 AIME I below, then check your answer against the professionally curated solution from LIVE by Po-Shen Loh. You can also try the full timed exam, view all 2005 AIME I solutions, or check the answer key.

All problems are used with official legal permission of the Mathematical Association of America (MAA).

12.

For positive integers n,n, let τ(n)\tau(n) denote the number of positive integer divisors of n,n, including 11 and n.n. For example, τ(1)=1\tau(1) = 1 and τ(6)=4.\tau(6) = 4. Define S(n)S(n) by S(n)=τ(1)+τ(2)+⋯+τ(n).S(n) = \tau(1) + \tau(2) + \cdots + \tau(n). Let aa denote the number of positive integers n≤2005n \le 2005 with S(n)S(n) odd, and let bb denote the number of positive integers n≤2005n \le 2005 with S(n)S(n) even. Find ∣a−b∣.|a - b|.
Answer: 25
Concepts:parityperfect squarefactor counting
Small hint:
τ(n)\tau(n) is odd exactly when nn is a perfect square, so S(n)S(n) changes parity only at squares
Big hint:
S(n)S(n) is odd exactly when ⌊n⌋\lfloor\sqrt{n}\rfloor is odd; count n≤2005n \le 2005 block by block between consecutive squares
Solution:
Divisors of nn pair up as dd and nd,\frac{n}{d}, so τ(n)\tau(n) is odd exactly when nn is a perfect square. Hence S(n)S(n) changes parity exactly at the squares, which means S(n)S(n) is odd exactly when the number of squares up to n,n, namely ⌊n⌋,\lfloor\sqrt{n}\rfloor, is odd.
For each k,k, there are 2k+12k + 1 integers nn with ⌊n⌋=k,\lfloor\sqrt{n}\rfloor = k, namely k2≤n≤k2+2k.k^2 \le n \le k^2 + 2k. Since 442=193644^2 = 1936 ≤2005\le 2005 <2025=452,\lt 2025 = 45^2, the odd values k=1,3,…,43k = 1, 3, \ldots, 43 all have their full blocks within range, so a=∑k odd, k≤43(2k+1)=2(1+3+⋯+43)+22=2⋅484+22=990. \begin{aligned} a &= \sum_{k \text{ odd},\, k \le 43} (2k + 1) \\ &= 2(1 + 3 + \cdots + 43) + 22 \\ &= 2 \cdot 484 + 22 \\ &= 990. \end{aligned}
Then b=2005−990=1015,b = 2005 - 990 = 1015, and ∣a−b∣=25.|a - b| = 25.
LIVE by Po-Shen Loh
Programs

LIVE Classes

Self-Paced Classes

Stars

Scholarship

About Us

Who Is Po-Shen Loh?

Email Contact

Newsletter

Jobs

Become a Star

For a more Thought Full world.

© 2026 Expii, Inc.