Skip to main content

2007 AIME II Problem 6

Problem 6 of 15IntermediateNumber TheoryCombinatorics

An integer is called parity-monotonic if its decimal representation a1a2a3…aka_1 a_2 a_3 \ldots a_k satisfies ai<ai+1a_i \lt a_{i+1} if aia_i is odd, and ai>ai+1a_i \gt a_{i+1} if aia_i is even. How many four-digit parity-monotonic integers are there?

Your answer

Integer from 0 to 999
Show solution

Solution

A digit aia_i may immediately precede ai+1=da_{i+1} = d exactly when aia_i is odd and less than d,d, or even and greater than d.d. Checking each dd from 00 to 9,9, this always allows exactly 44 digits: for example, d=0d = 0 allows 2,2, 4,4, 6,6, 8;8; d=4d = 4 allows 1,1, 3,3, 6,6, 8;8; d=9d = 9 allows 1,1, 3,3, 5,5, 7.7. (Raising dd by 11 trades odd choices for even ones, keeping the total at 4.4.) Note that 00 is never an allowed predecessor, since 00 is even but exceeds no digit. So choose the last digit a4a_4 in 1010 ways, then each of a3,a_3, a2,a_2, a1a_1 in 44 ways; the leading digit is automatically nonzero. The count is 43⋅10=640.4^3 \cdot 10 = 640.
AoPS wiki

Tagged: digits · parity · multiplication principle

More practice