How many positive integers less than a million have either a 2 or a 4 (but not both) in its digits?

200 Views Asked by At

I am aware that there are 468559 numbers less than 1,000,000 with 2 as digit as shown here, so I assume that means there are also 468559 numbers less than 1,000,000 with 4 as a digit. However, how do you find how many positive integers less than 1,000,000 that have either 2 or 4 as a digit, but not both?

1

There are 1 best solutions below

0
On

First count the how many numbers there are without any 4.

Then subtract how many there are without any 2 or 4.

You have now how many numbers there are with at least one 2 and no 4.

The same computation will show how many there are with at least one 4 and no 2.