2004 AIME I Problems/Problem 6
Problem
An integer is called snakelike if its decimal representation satisfies if is odd and if is even. How many snakelike integers between 1000 and 9999 have four distinct digits?
Solution
We divide the problem into two cases: one in which zero is one of the digits and one in which it is not. In the latter case, suppose we pick digits such that . There are five arrangements of these digits that satisfy the condition of being snakelike: , , , , . Thus there are snakelike numbers which do not contain the digit zero.
In the second case we choose zero and three other digits such that . There are three arrangements of these digits that satisfy the condition of being snakelike: , , . Because we know that zero is a digit, there are snakelike numbers which contain the digit zero. Thus there are snakelike numbers.