Q.4:-Find the sum of all 3-digit natural numbers which contain at least one odd digit and at least one even digit?
The sum of all 3-digit natural numbers with at least
one odd and at least one even digit
equals
the sum of all 3-digit numbers
minus
the sum or all 3-digit numbers with only odd digits
minus
the sum of all 3-digit numbers with only even digits.
So we need three things:
1. The sum of all 3-digit numbers
2. The sum of all 3-digit numbers with only odd digits.
3. The sum of all 3-digit numbers with only even digits
------------------------------------
1. We find the sum of all 3-digit numbers. To do that we sum
an arithmetic series. There are 900 3-digit numbers
(999 minus the 99 integers from 1 to 99), so we use:
2. We find the sum of all 3-digit numbers with only odd digits
There are five odd digits 1,3,5,7,and 9
There are 5 ways to choose the first digit, 5 ways to choose the
2nd digit, and 5 ways to choose the third digit. So there are
5x5x5 or 125 3-digit numbers with only odd digits. Among the 125
units digits there are the same number of each odd digit. That is,
there are 25 1's, 25 3's, 25 5's, 25 7's and 25 9's. Therefore
the sum of all the units digits is 25*(1+3+5+7+9) = 25*(25) = 625.
It's the same with the sum of all the tens digits and the same
with the sum of all the hundreds digits. So the total
sum of all three-digit numbers with only odd digits is
100*625 + 10*625 + 625 = 69375
3. We find the sum of all 3-digit numbers with only even digits
It's a little different here because the hundreds digit cannot be 0,
but the other two can be 0.
There are five even digits 0,2,4,6,and 8
There are only 4 ways to choose the first digit since it can't be 0,
There are 5 ways to choose the 2nd digit, and 5 ways to choose the
third digit. So there are 4x5x5 or 100 3-digit numbers with only even
digits. Among the 100 units digits there are the same number of each
even digit. That is, there are 20 0's, 20 2's, 20 4's, 20 6's and 20 8's.
Therefore the sum of the units digits is 20*(0+2+4+6+8) = 20*(20) = 400.
It's the same with the tens digit, that is the sum of all the tens
digits is also 400.
However among the 100 hundreds digits there are no 0's. But there are
the same number of each of the even digits 2, 4, 6, and 8. So there are
25 2's, 25 4's, 25 6's, and 25 8's. Therefore the sum of all the hundreds
digits is 25(2+4+6+8) = 25(20)= 500.
So the sum of all 3 digit numbers with only even digits is
100(500) + 10(400) + 400 = 54400
=====
So
The sum of all 3-digit natural numbers with at least one odd and
at least one even digit =
the sum of all 3-digit numbers, which is 494550
minus
the sum or all 3-digit numbers with only odd digits,
which is 69375
minus
the sum of all 3-digit numbers with only even digits,
which is 54400.
So we get 494550 - 69375 - 54400 = 370775
Edwin