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.
Estimate: 347733
Calculated: 350499
For the estimate, consider each of the 6 digits in turn, starting with the last.
The last digit can have 7 values: not 0, 3 or 5.
The second through fifth digits can take 9 values: anything but 3.
The first digit can either be a 1, which is a special case, or can take 7 other values: 2,4,5,6,7,8,9.
So last 5 digits can occur in 9*9*9*9*7 ways
Multiply that by a 7 to get the solution if the problem had started with 200000.
But about 3/7 of the 6 digit numbers starting with a 1 are not part of our problem, so we need to add about 4/7 of 9*9*9*9*7 to account for range(142858, 200000)
Estimate:
= (7+4/7)*9*9*9*9*7
= (53/7)*9*9*9*9*7
= 53*9*9*9*9 = 347733
(which is off by 2766)
==== Python code ====
count = 0
for i in range(142858, 1000000):
if i%5 == 0:
continue
if '3' in str(i):
continue
count += 1
estimate = 53*9*9*9*9
print(count, estimate)
Edited on December 4, 2021, 8:55 am

Posted by Larry
on 20211204 08:54:53 