The number of 5-digit numbers greater than $50000$ that can be formed using the digits $0,1,2,3,4,5,6,7$ (repetition allowed) such that the sum of the first and last digit is at most 8 is
Step-by-Step Solution
Key Concept: Fix the leading digit as 5, 6, or 7, count valid last digits for each, multiply by $8^3$ for the middle three, then subtract 1 for 50000 (which is not strictly greater than 50000).
First digit $\in\{5,6,7\}$. Middle three: $8^3=512$ choices each.
First digit 5, last digit $\leq3$: 4 choices (0,1,2,3). Subtotal: $512\times4=2048$.
First digit 6, last digit $\leq2$: 3 choices. Subtotal: $512\times3=1536$.
First digit 7, last digit $\leq1$: 2 choices. Subtotal: $512\times2=1024$.
Total including 50000: $2048+1536+1024=4608$.
But 50000 (= 5,0,0,0,0; sum $=5+0=5\leq8$) is not $>50000$, so subtract 1.
Answer: $4608-1=4607$.
Correct Answer: 4