Skip to main content

2005 AIME I Problem 12

Problem 12 of 15HarderNumber Theory

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|.

Your answer

Integer from 0 to 999
Show solution

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.
AoPS wiki

Tagged: parity · perfect square · factor counting

More practice