The idea is to pick the smallest possible 1st digit that will permit the number
to have 4 different digits. Then we pick the smallest possible 2nd digit that
will permit the number to have 4 different digits, and so on until we have
picked all 7 digits.
The smallest first digit we can pick is 1. We can't pick 0 since it wouldn't have
7 digits.
The smallest 2nd digit we can pick is 0. We have now picked 2 different digits,
and have 5 more digits to pick, and we only need to pick 2 more different
digits.
The smallest 3rd digit we can pick is also 0. We have picked 2 different
digits, and have 4 more digits to pick, and we only need to pick 2 more
different digits.
The smallest 4th digit we can pick is also 0. We have picked 2 different
digits, and have 3 more digits to pick, and we only need to pick 2 more
different digits.
The smallest 5th digit we can pick is also 0. We have picked 2 different
digits, and have 2 more digits to pick, and we only need to pick 2 more
different digits.
The smallest 6th digit we can pick is 2. We have picked 3 different digits, and
have 1 more digit to pick.
The smallest 7th and last digit we can pick is 3.
Answer: 1000023 is the smallest possible 7 digit number with 4 different digits.
Edwin