We need to find the set A of all 4-digit natural numbers with exactly one digit equal to 7. A 4-digit number has digits d1d2d3d4 where d1∈{1,2,…,9} and d2,d3,d4∈{0,1,…,9}. Exactly one of these digits is 7.
We count ∣A∣ by considering which position has the digit 7. If d1=7: the remaining 3 digits are chosen from {0,1,…,9}∖{7}, giving 93=729 numbers. If d2=7 (or d3=7 or d4=7): d1 is from {1,…,9}∖{7}=8 choices, and the other two non-7 positions each have 9 choices. So each gives 8×92=648 numbers.
Thus ∣A∣=729+3×648=729+1944=2673.
For the number to leave remainder 2 when divided by 5, the last digit d4 must be 2 or 7 (since 2≡2(mod5) and 7≡2(mod5)).
Case 1: d4=7 (so the 7 is in the units place). Then d1∈{1,…,9}∖{7} (8 choices), d2,d3∈{0,…,9}∖{7} (9 choices each). This gives 8×9×9=648 numbers.
Case 2: d4=2 (so the 7 is in one of the other three positions). Sub-case (a): d1=7, then d2,d3∈{0,…,9}∖{7} giving 9×9=81 numbers. Sub-case (b): d2=7, then d1∈{1,…,9}∖{7} (8 choices), d3∈{0,…,9}∖{7} (9 choices), giving 8×9=72. Sub-case (c): d3=7, similarly gives 8×9=72.
So Case 2 total = 81+72+72=225.
Total favorable = 648+225=873.
The probability = 2673873=29797 (dividing numerator and denominator by 9).
Therefore, the required probability is 29797.