Re: How many 3-digit positive integrs are odd and do not contain the digit "5"?




me wrote:
> Thanks.
>
> I was thinking to get all the possible numbers and then subtract the
> ones with 5. Pbviously, that kind of approcah would not be the way to
> go about probability. I need to change my thinking pattern.

That would also work, but it would have entailed more work:

there are 900 3-digit integers.
a) 100 of them have a 5 in the hundreds' place
b) 90 of them have a 5 in the tens' place
c) 540 have a 5 or an even digit in the ones place
10 fall into categories a & b
60 fall into categories a & c
54 fall into categories b & c
6 fall into all three categories.

by inclusion-exclusion, the total number that have a 5 or are odd is:
100 + 90 + 540 -10 -60 -54 +6= 612

So the number that don't is 900 - 612 = 288 (which is the same answer
as above)

As I said, this is much longer, but still works.

.



Relevant Pages

  • Re: perl cumulative module question
    ... Rob Dixon wrote: ... Your arithmetic is odd. ... If you want to subtract the ... my $prev = 0; ...
    (perl.beginners)
  • Re: Countdown
    ... > add, shift left, shift right, and "check the bit you've just shifted ... checking for odd and even. ... biggest binary number that can be subtract from it and then repeat this ...
    (uk.media.radio.archers)
  • Re: problems hashing
    ... i dont know if that is over simplified, you may have to add or ... subtract from the array indexes i provided. ... Perl expects the data to have a value for every key. ... The data has an odd number of elements. ...
    (perl.beginners)
  • Re: Proof...
    ... > Repeat until n is 1. ... > if n is odd then subtract 1 from n ... > if n is even then divide n by 2 ...
    (sci.math)
  • Re: perl cumulative module question
    ... Your arithmetic is odd. ... If you want to subtract the ... To unsubscribe, e-mail: beginners-unsubscribe@xxxxxxxx ... For additional commands, e-mail: beginners-help@xxxxxxxx ...
    (perl.beginners)