How many natural numbers exist in the range 142858 to 999999 inclusive, such that :
a. None of them is a multiple of 5.
b. The digit 3 is not contained in the number
D1 Please provide your estimate solution (p & p)
D3. Evaluate the exact result.
First an estimate: 142858 is about 1/7 of 10^6. No 3s limits us to 9 digits. And no multiple of 5 reduces the options by a factor of 4/5. Then (6/7)*9^6*(4/5) = 364417
Exact calculation:
Lets split the six digit numbers into two parts, the last digit and the first five digits. Condition b applies to both parts and condition a applies only to the last digit.
The last digit is one of {1,2,4,6,7,8,9}
The potential first five digits can be mapped to base 9 numbers. Lets split the boundary number 142858 into 14285 and 8. Map 14285 to base 9 by reducing any digit larger than three: 13274 base 9. Then 13274 base 9 = 8977.
From this there are 8977 possible sets of first five digits that are lower than 14285 (including 00000). Then there are 9^5-(8977+1) = 50071 possible sets of first five digits larger than 14285.
So the total quantity of natural numbers that Ady asks for is 50071 possible starting digits * 7 possible last digits + 2 specific cases of 142858 and 142859. Then 50071*7+2 = 350499.
364417/350499 = 1.0397, so my estimate was only about 4% bigger than the actual number.