Choosing randomly two integer numbers from 10 to 1,000,000 inclusive,
What are the chances they will be represented:
a. each by two distinct digits, albeit different
for each one of the numbers e.g. 322 and 78778
b.exactly the same two, like 3334 and 433344
or
c. distinct couples, sharing one digit like 5558 and 88338
As a warm up:
How many different ways can an n-digit number be formed of exactly 2 distinct digits, say 'a' and 'b'?
If one of a,b is zero, and the number must start with, say, 'a', then it is the number of n digit binary numbers, which is 2^(n-1) - 1
If a and b are both nonzero, then it is twice the number of n digit binary numbers, which is 2(2^(n-1) - 1) or 2^(n) - 2.
There are C(9,2) = 36 ways of picking 2 digits, both nonzero
There are 9 ways of picking 2 digits, with one being zero
So for n digits, the 'number of ways' is:
36*(2^(n) - 2) + 9*(2^(n-1) - 1)
or
36*(2^n) + 9*(2^(n-1)) - 81
Summing this for n = 2 up to 7 (and then add one more for 10,000,000 itself) gives: 9721
|
Posted by Larry
on 2023-07-14 09:30:15 |