1982 AHSME Problems/Problem 11

Problem

How many integers with four different digits are there between $1,000$ and $9,999$ such that the absolute value of the difference between the first digit and the last digit is $2$?

$\textbf {(A)}\ 672 \qquad  \textbf {(B)}\ 784 \qquad  \textbf {(C)}\ 840 \qquad  \textbf {(D)}\ 896 \qquad  \textbf {(E)}\ 1008$

Solution

All of the digits of the numbers must be 0 to 9. If the first and last digits are x and y, we have $x-y=2$ and $0<x<9$ or $y-x=2,$ and $0<y<9.$ Substituting we have $0<x+2<9,$ and $0<y+2<9.$ Thus $0<x<7$ and $0<y<7,$ which yields 16 pairs (x, y) such that the absolute value of the difference between the x and y is $2.$ However, we are not done. If 0 is the last digit ( with the pair (0, 2):) then we won't have a 4 digit number, so our real value is 15. Because our digits are distinct, there are $(10-2)(10-3)$ ways to fill the middle 2 places with digits, thus by the multiplication principles (counting) there are $15\cdot56 = \boxed {\left(C\right) 840}$ numbers that fulfill these circumstances.