Correct Answer: 42
All valid numbers are 4-digit numbers between 5000 and 9000.
Hence, the thousand’s digit must be 5.
So every number is of the form: $$ 5xyz \quad \text{where } x,y,z \in \{0,1,2,5,9\} $$
For divisibility by 3, sum of digits must be divisible by 3:
$$ 5+x+y+z \equiv 0 \pmod{3} $$
Since $5 \equiv 2 \pmod{3}$, we require:
$$ x+y+z \equiv 1 \pmod{3} $$
Residue classification modulo 3:
Class 0: $\{0,9\}$ (2 digits)
Class 1: $\{1\}$ (1 digit)
Class 2: $\{2,5\}$ (2 digits)
All possible residue combinations of $(x,y,z)$ giving sum $\equiv 1 \pmod{3}$:
1. $(1,0,0)$
2. $(1,1,2)$
3. $(2,2,0)$
Case 1: (1,0,0)
Position of residue-1 digit: $3$ ways
Choice of digit from class-1: $1$ way
Choice of two class-0 digits: $2^2=4$ ways
Total: $$ 3 \times 1 \times 4 = 12 $$
Case 2: (1,1,2)
Position of residue-2 digit: $3$ ways
Choice of class-2 digit: $2$ ways
Total: $$ 3 \times 2 = 6 $$
Case 3: (2,2,0)
Position of residue-0 digit: $3$ ways
Choice of class-0 digit: $2$ ways
Choice of two class-2 digits: $2^2=4$ ways
Total: $$ 3 \times 2 \times 4 = 24 $$
Total valid numbers:
$$ 12 + 6 + 24 = \boxed{42} $$
All residue cases are exhausted, counting is consistent, and no over-counting is involved.
Updated for JEE Main 2026: This PYQ is important for JEE Mains, JEE Advanced and other competitive exams. Practice more questions from this chapter.