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