AMC 10 Step by Step

2022 AMC 10A Problem 24

P21-25~12 minPrint

How many strings of length 55 formed from the digits 00 , 11 , 22 , 33 , 44 are there such that for each j∈{1,2,3,4}j \in \{1,2,3,4\} , at least jj of the digits are less than jj ? (For example, 0221402214 satisfies this condition because it contains at least 11 digit less than 11 , at least 22 digits less than 22 , at least 33 digits less than 33 , and at least 44 digits less than 44 . The string 2340423404 does not satisfy the condition because it does not contain at least 22 digits less than 22 .)

Log in to save your progress.
Show solution without answering

Key insight

Count the bad strings by the first condition they break. At that point the string splits into a smaller good string of low digits plus a block of high digits.

Solution

There are 55=31255^5 = 3125 strings in all. It is easier to count the strings that fail, sorted by the first condition they break.

Step 1: small good strings we will need. Call a string "good" if it passes all its conditions.
- Length 22, digits 0,10, 1, needing at least one digit less than 11 (a 00): 00,01,1000, 01, 10. That is 33 strings.
- Length 33, digits 0,1,20, 1, 2, needing at least one 00 and at least two digits less than 22. Out of 2727 strings, 23=82^3 = 8 have no 00, and 33 have exactly one 00 with two 22s (022,202,220022, 202, 220). So 27−8−3=1627 - 8 - 3 = 16 are good.

Step 2: count the bad strings of length 5.

  • First failure at j=1j = 1: no digit is 00. Each digit is one of 1,2,3,41, 2, 3, 4: 45=10244^5 = 1024 strings.
  • First failure at j=2j = 2: there is a 00, but at most one digit less than 22. So there is exactly one 00, no 11s, and the other four digits are 2,32, 3 or 44. Place the 00 in 55 ways; the rest give 34=813^4 = 81. Total 5×81=4055 \times 81 = 405.
  • First failure at j=3j = 3: at least two digits are less than 22, but at most two are less than 33. So exactly two digits are small (both 00 or 11), and they must include a 00: they form one of the 33 good pairs from Step 1. The other three digits are 33 or 44. Choose the two spots in (52)=10\binom52 = 10 ways: 10×3×23=24010 \times 3 \times 2^3 = 240.
  • First failure at j=4j = 4: at least three digits are less than 33, but at most three are less than 44. So exactly three digits are small (each 00, 11 or 22), and they must pass the earlier conditions: they form one of the 1616 good strings of length 33. The other two digits must be 44. Choose the three spots in (53)=10\binom53 = 10 ways: 10×16×1=16010 \times 16 \times 1 = 160.

Each bad string has exactly one first failure, so nothing is counted twice. Bad strings: 1024+405+240+160=18291024 + 405 + 240 + 160 = 1829.

Step 3: subtract. Good strings: 3125−1829=12963125 - 1829 = 1296.

The answer is (E) 1296\boxed{\textbf{(E)}\ 1296}.

Why this works

The conditions build on one another, so a failing string has a first failure, and at that moment it splits cleanly into a shorter good string of small digits plus a block of large digits. That is why counting the failures works and why it reuses the counts for shorter strings. The counts for lengths 11 to 55 are 1,3,16,125,12961, 3, 16, 125, 1296, which are 20,31,42,53,642^0, 3^1, 4^2, 5^3, 6^4, a pattern worth remembering.

Alternative approach

Under time pressure, find the small cases and guess the pattern. Length 11 (digit 00 only): 11 string. Length 22: 33 strings. Length 33: 1616 strings (Step 1 above). The numbers 1,3,161, 3, 16 are 20,31,422^0, 3^1, 4^2, which suggests length 55 gives 64=12966^4 = 1296, and that is one of the choices. Length 44 can be checked the same way as Step 2: 256−(81+32+18)=125=53256 - (81 + 32 + 18) = 125 = 5^3, which supports the pattern.

Concise solution

A shorter write-up, the way contest solutions are usually written. It may take a different route from the solution above.

Call a string of length nn over the digits 0,…,n−10, \dots, n-1 good if for every j=1,…,n−1j = 1, \dots, n-1 at least jj of its digits are less than jj. Let GnG_n be the number of good strings, with G0=1G_0 = 1 (the empty string). We want G5G_5.

Count the bad strings by their smallest failing jj. Condition j−1j-1 holds (at least j−1j-1 digits below j−1j-1) while condition jj fails (at most j−1j-1 digits below jj). Digits below j−1j-1 are also below jj, so exactly j−1j-1 digits are below jj, and all of them are actually below j−1j-1. Among themselves these j−1j-1 digits satisfy conditions 1,…,j−21, \dots, j-2, so they form a good string of length j−1j-1. The other n−j+1n-j+1 digits are each at least jj, chosen from the n−jn-j values j,…,n−1j, \dots, n-1. Choosing the positions of the small digits,
badn=∑j=1n−1(nj−1) Gj−1 (n−j) n−j+1,Gn=nn−badn.\text{bad}_n = \sum_{j=1}^{n-1} \binom{n}{j-1}\, G_{j-1}\, (n-j)^{\,n-j+1}, \qquad G_n = n^n - \text{bad}_n.
(The case j=nj = n never fails.) Compute:

  • G1=1G_1 = 1.
  • G2=4−(20)⋅1⋅12=3G_2 = 4 - \binom{2}{0} \cdot 1 \cdot 1^2 = 3.
  • G3=27−(1⋅1⋅23+(31)⋅1⋅12)=27−11=16G_3 = 27 - \left(1 \cdot 1 \cdot 2^3 + \binom{3}{1} \cdot 1 \cdot 1^2\right) = 27 - 11 = 16.
  • G4=256−(34+(41)⋅1⋅23+(42)⋅3⋅12)=256−131=125G_4 = 256 - \left(3^4 + \binom{4}{1} \cdot 1 \cdot 2^3 + \binom{4}{2} \cdot 3 \cdot 1^2\right) = 256 - 131 = 125.
  • G5=3125−(45+(51)⋅1⋅34+(52)⋅3⋅23+(53)⋅16⋅12)=3125−(1024+405+240+160)=1296G_5 = 3125 - \left(4^5 + \binom{5}{1} \cdot 1 \cdot 3^4 + \binom{5}{2} \cdot 3 \cdot 2^3 + \binom{5}{3} \cdot 16 \cdot 1^2\right) = 3125 - (1024 + 405 + 240 + 160) = 1296.

The answer is (E) 1296\boxed{\textbf{(E)}\ 1296}.

Review in the AoPS books

Similar problems

Problem © Mathematical Association of America (MAA), American Mathematics Competitions. Reproduced for non-commercial educational use. Solution and commentary are original to this site.