2004 AIME I Problem 15

Below is the professionally curated solution for Problem 15 of the 2004 AIME I, from LIVE by Po-Shen Loh. You can also try the full timed exam, view all 2004 AIME I solutions, or check the answer key.

All of the real AMC 8, AMC 10, AMC 12, and AIME problems in our complete solution collection are used with official legal permission of the Mathematical Association of America (MAA).

Concepts:recursive countingtree diagramwork backwards

Difficulty rating: 3370

15.

For all positive integers x,x, let f(x)={1if x=1,x/10if x is divisible by 10,x+1otherwise,f(x) = \begin{cases} 1 & \text{if } x = 1, \\ x/10 & \text{if } x \text{ is divisible by } 10, \\ x + 1 & \text{otherwise,} \end{cases} and define a sequence as follows: x1=xx_1 = x and xn+1=f(xn)x_{n+1} = f(x_n) for all positive integers n.n. Let d(x)d(x) be the smallest nn such that xn=1.x_n = 1. (For example, d(100)=3d(100) = 3 and d(87)=7.d(87) = 7.) Let mm be the number of positive integers xx such that d(x)=20.d(x) = 20. Find the sum of the distinct prime factors of m.m.

Solution:

Work backwards: f(z)=zf(z') = z for z=10zz' = 10z (always) and for z=z1z' = z - 1 (provided z1z - 1 is not a multiple of 1010 and z11,z - 1 \ne 1, i.e. zz does not end in 11 and z2z \ne 2). So the integers with d(x)=nd(x) = n form column nn of a tree rooted at 1:1: the columns begin {1},\{1\}, {10},\{10\}, {9,100},\{9, 100\}, {8,90,99,1000},\{8, 90, 99, 1000\}, and every vertex has two children except 22 and the vertices ending in 1,1, which have only the child 10z.10z.

Locate those one-child vertices. Since 23101,2 \to 3 \to \cdots \to 10 \to 1, the vertex 22 sits in column 10.10. A vertex ending in 11 is reached by subtracting 11 nine times from a vertex ending in 0,0, so such vertices sit 99 columns after the multiples of 1010 in the tree. Columns 22 through 1010 double perfectly (no one-child vertices occur that early), so column jj has 2j22^{j-2} vertices, of which the multiples of 1010 — the children 10z10z of column j1j - 1 — number 2j3.2^{j-3}. Hence for 12k19,12 \le k \le 19, column kk contains 2k122^{k-12} vertices ending in 11 (column 1111 has none, because the multiple of 1010 in column 22 is 1010 itself, whose descendant 11 is excluded — that exclusion is exactly the missing child of 22).

A one-child vertex in column kk removes 219k2^{19-k} of the potential 2182^{18} vertices from column 20.20. Therefore m=21829k=12192k12219k=21829827=29(2912)=29509.m = 2^{18} - 2^{9} - \sum_{k=12}^{19} 2^{k-12} \cdot 2^{19-k} = 2^{18} - 2^9 - 8 \cdot 2^7 = 2^9(2^9 - 1 - 2) = 2^9 \cdot 509. Since 509509 is prime, the sum of the distinct prime factors of mm is 2+509=511.2 + 509 = 511.

← Problem 14Full Exam

Problem 15 in Other Years