返回题库

AIME 2004 I · 第 15 题

AIME 2004 I — Problem 15

专题
Contest Math
难度
L4
来源
AIME

题目详情

Problem

For all positive integers xx, let

f(x)={1if x=1x10if x is divisible by 10x+1otherwisef(x)=\begin{cases}1 & \text{if }x = 1\\ \frac 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 nn. Let d(x)d(x) be the smallest nn such that xn=1x_n=1. (For example, d(100)=3d(100)=3 and d(87)=7d(87)=7.) Let mm be the number of positive integers xx such that d(x)=20d(x)=20. Find the sum of the distinct prime factors of mm.

解析

Solution

Solution 1

We backcount the number of ways. Namely, we start at x20=1x_{20} = 1, which can only be reached if x19=10x_{19} = 10, and then we perform 1818 operations that either consist of A:(1)A: (-1) or B:(×10)B: (\times 10). We represent these operations in a string format, starting with the operation that sends f(x18)=x19f(x_{18}) = x_{19} and so forth downwards. There are 292^9 ways to pick the first 99 operations; however, not all 99 of them may be A:(1)A: (-1) otherwise we return back to x10=1x_{10} = 1, contradicting our assumption that 2020 was the smallest value of nn. Using complementary counting, we see that there are only 2912^9 - 1 ways.

Since we performed the operation B:(×10)B: (\times 10) at least once in the first 99 operations, it follows that x1020x_{10} \ge 20, so that we no longer have to worry about reaching 11 again.

However, we must also account for a sequence of 1010 or more A:(1)A: (-1)s in a row, because that implies that at least one of those numbers was divisible by 1010, yet the x10\frac{x}{10} was never used, contradiction. We must use complementary counting again by determining the number of strings of A,BA,Bs of length 1818 such that there are 1010 AAs in a row. The first ten are not included since we already accounted for that scenario above, so our string of 1010 AAs must be preceded by a BB. There are no other restrictions on the remaining seven characters. Letting \square to denote either of the functions, and [k]^{[k]} to indicate that the character appears kk times in a row, our bad strings can take the forms:

BA[10]BA[10]BA[10]BA[10]\begin{aligned} &\underbrace{BA^{[10]}}\square \square \square \square \square \square \square\\ &\square \underbrace{BA^{[10]}}\square \square \square \square \square \square \\ &\qquad \quad \cdots \quad \cdots \\ &\square \square \square \square \square \square \underbrace{BA^{[10]}} \square \\ &\square \square \square \square \square \square \square \underbrace{BA^{[10]}} \\ \end{aligned} There are 272^7 ways to select the operations for the 77 \squares, and 88 places to place our BA[10]BA^{[10]} block. Thus, our answer is 29(291)827=21829827=29×5092^9(2^9-1)-8\cdot 2^7 = 2^{18} - 2^9 - 8 \cdot 2^7 = 2^9 \times 509, and the answer is 511\boxed{511}.

Note: This solution is quick and most similar to the official solution; however, neither this nor the official solution prove that the final results of these inverted operations are all distinct. A more sophisticated argument, such as the one below, is needed to do so.

Solution 2

We approach the problem by recursion. We partition the positive integers into the sets

An,k={xZ+:d(x)=n and xk(mod10)}.\mathcal{A}_{n,k}=\{x\in\mathbb{Z}^+\,:\, d(x)=n\text{ and } x\equiv k\pmod{10}\}. First, we note that A1,1={1}\mathcal{A}_{1,1}=\{1\}, so by the disjointness of the An,k\mathcal{A}_{n,k}'s, we know that 11 is not in any of the other sets. Also, we note that A1,k=\mathcal{A}_{1,k}=\emptyset for k=0,2,3,4,5,6,7,8,9k=0,2,3,4,5,6,7,8,9.

We claim that if 2k92\le k\le 9 and n2n\ge2, then An,k=An1,k+1|\mathcal{A}_{n,k}|=|\mathcal{A}_{n-1,k+1}|. To prove this, we show that ff (the given function) maps An,k\mathcal{A}_{n,k} bijectively onto An1,k+1\mathcal{A}_{n-1,k+1}. If xAn,kx\in \mathcal{A}_{n,k}, then xk(mod10)x\equiv k\pmod{10}, and x1x\ne 1, so f(x)=x+1k+1(mod10)f(x)=x+1\equiv k+1\pmod{10}. Also, f(n)(x)=1f^{(n)}(x)=1, where nn is the smallest positive integer for which this is true. Therefore, fn1(f(x))=1f^{{n-1}}(f(x))=1, where n1n-1 is the smallest integer for which this is true. Thus f(x)An1,k+1f(x)\in\mathcal{A}_{n-1,k+1}. Also, since f(x)=x+1f(x)=x+1 on this set, we see that f(x)=f(y)f(x)=f(y) implies that x=yx=y. Hence ff is an injection. If yAn1,k+1y\in\mathcal{A}_{n-1,k+1}, then y1k(mod10)y-1\equiv k\pmod{10}, where 2k92\le k\le 9, so we know that f(y1)=yf(y-1)=y, and y1An,ky-1\in \mathcal{A}_{n,k}. Therefore, ff is a surjection, so it must be a bijection. Therefore, if 2k92\le k\le 9 and n2n\ge2, then An,k=An1,k+1|\mathcal{A}_{n,k}|=|\mathcal{A}_{n-1,k+1}|.

We also claim that if k=1k=1, n2n\ge 2 and n11n\ne 11, then An,k=An1,k+1|\mathcal{A}_{n,k}|=|\mathcal{A}_{n-1,k+1}|. The proof is the same as in the previous paragraph, though some additional clarification is needed to prove that ff is a surjection. If yAn1,k+1y\in\mathcal{A}_{n-1,k+1}, or rather y1k1(mod10)y-1\equiv k\equiv 1\pmod{10}, then if y=2y=2, we see that y1=1y-1=1, and then f(y1)=1f(y-1)=1, not yy as in the prior argument. However, this does not happen if n11n\ne 11. It is easy to check that 2A10,22\in\mathcal{A}_{10,2}. Therefore, the only time that the above argument could fail is if n1=10n-1=10 and k+1=2k+1=2. But in every other case, An,k=An1,k+1|\mathcal{A}_{n,k}|=|\mathcal{A}_{n-1,k+1}|.

Next, we claim that if n3n\ge 3, then

An,0=k=09An1,k|\mathcal{A}_{n,0}|=\Big|\bigcup_{k=0}^9\mathcal{A}_{n-1,k}\Big| If xAn,0x\in\mathcal{A}_{n,0}, then f(x)=x10f(x)=\tfrac{x}{10}, which is clearly an injective map. Also, f(n)(x)=1f^{(n)}(x)=1, where nn is the smallest positive integer for which this is true. Therefore, fn1(f(x))=1f^{{n-1}}(f(x))=1, where n1n-1 is the smallest integer for which this is true. Thus f(x)An1,kf(x)\in\mathcal{A}_{n-1,k} for some kk. Conversely, if yAn1,ky\in \mathcal{A}_{n-1,k}, then f(10y)=yf(10y)=y, so d(10y)=nd(10y)=n, so 10yAn,010y\in\mathcal{A}_{n,0}.

Based on these bijections, if we let An,k=An,kA_{n,k}=|\mathcal{A}_{n,k}|, then

An,0=k=09An1,kAn,1=An1,2if n11An,2=An1,3An,3=An1,4An,8=An1,9An,9=An1,0.\begin{aligned} A_{n,0}&=\sum_{k=0}^{9} A_{n-1,k}\\ A_{n,1}&=A_{n-1,2}\qquad\text{if }n\ne 11\\ A_{n,2}&=A_{n-1,3}\\ A_{n,3}&=A_{n-1,4}\\ &\vdots\\ A_{n,8}&=A_{n-1,9}\\ A_{n,9}&=A_{n-1,0}. \end{aligned} Let Sn=k=09An,kS_n=\sum_{k=0}^9 A_{n,k}. Then by adding the above equations (valid if n11n\ne 11), we find that

Sn=2Sn1An1,1.S_n=2S_{n-1}-A_{n-1,1}. Now by using the above relations repeatedly, we find

An1,1=An2,2=An3,3==An9,9=An10,0=Sn11.A_{n-1,1}=A_{n-2,2}=A_{n-3,3}=\cdots=A_{n-9,9}=A_{n-10,0}=S_{n-11}. The first relation will only be valid if n12n\ne 12. Therefore, Sn=2Sn1Sn11S_n=2S_{n-1}-S_{n-11} for n13n\ge 13. For smaller values, it is easy to use the relations to compute that the terms are powers of 22, although we note that A11,1=0A_{11,1}=0 because of the failure of the above argument.

nAn,1An,2An,3An,4An,5An,6An,7An,8An,9An,0Sn110000000001200000000011300000000112400000001124500000011248600000112481670000112481632800011248163264900112481632641281001124816326412825611012481632641282565111212481632641282565111022\begin{array}{c|cccccccccc|c} n&A_{n,1}&A_{n,2}&A_{n,3}&A_{n,4}&A_{n,5}&A_{n,6}&A_{n,7}&A_{n,8}&A_{n,9}&A_{n,0}&S_{n}\\\hline 1&1&0&0&0&0&0&0&0&0&0&1\\ 2&0&0&0&0&0&0&0&0&0&1&1\\ 3&0&0&0&0&0&0&0&0&1&1&2\\ 4&0&0&0&0&0&0&0&1&1&2&4\\ 5&0&0&0&0&0&0&1&1&2&4&8\\ 6&0&0&0&0&0&1&1&2&4&8&16\\ 7&0&0&0&0&1&1&2&4&8&16&32\\ 8&0&0&0&1&1&2&4&8&16&32&64\\ 9&0&0&1&1&2&4&8&16&32&64&128\\ 10&0&1&1&2&4&8&16&32&64&128&256\\ 11&\boxed{0}&1&2&4&8&16&32&64&128&256&511\\ 12&1&2&4&8&16&32&64&128&256&511&1022\\ \end{array} After this, we can simply use the recurrence relation for SnS_n, finding

nSn11213214225236247258269271028112911221021321115142122615213471621488172151691821632101921764112021812812.\begin{array}{c|l} n&S_n\\\hline 1&1\\ 2&1\\ 3&2^1\\ 4&2^2\\ 5&2^3\\ 6&2^4\\ 7&2^5\\ 8&2^6\\ 9&2^7\\ 10&2^8\\ 11&2^9-1\\ 12&2^{10}-2\\ 13&2^{11}-1\cdot 5\\ 14&2^{12}-2\cdot 6\\ 15&2^{13}-4\cdot 7\\ 16&2^{14}-8\cdot 8\\ 17&2^{15}-16\cdot 9\\ 18&2^{16}-32\cdot 10\\ 19&2^{17}-64\cdot 11\\ 20&2^{18}-128\cdot 12. \end{array} Therefore, there are 2182932^{18}- 2^9\cdot 3 positive integers xx with d(x)=20d(x)=20. This factors as 29(293)=29(509)2^9(2^{9}-3)=2^9(509), where 509509 is prime. Thus the answer is 511\boxed{511}.