Determine the sum of all 3-digit positive integers which contain at least one odd digit and at least one even digit. (For purposes of the problem, zero is an even digit.)
A. all 3 digit numbers from 100 to 999
how many: 999 - 100 + 1 = 1099
average: (100 + 999)/2 = 450
450*1099 = 494550
B. all digits odd:
how many: 5*5*5 = 125
avg of each digit is avg{1,3,5,7,9}
average: 555
125*555 = 69375
C. all digits even:
how many: 4*5*5 = 100
the average of the 1st digit is avg{2,4,6,8}
the average of the other digits is avg{0,2,4,6,8}
average: 544
100*544 = 54400
Required total = A - B - C =
494550 - 69375 - 54400 = 370775
|
Posted by Larry
on 2022-11-01 07:02:51 |