How many positive integers less than 1000 are there which contain at least one 4 or at least one 9 (or both)?

well, all the 400's and all the 900's

and all the 40's & 90's of the other 8 hundreds

and all the other 8 numbers ending in 9 for the other 8 hundreds

To find the number of positive integers less than 1000 that contain at least one 4 or one 9 (or both), we can use the principle of inclusion-exclusion.

Step 1: Count the numbers that contain at least one 4.
To do this, we need to look at each digit separately. Out of the 3 digits, we can choose one position to place the 4. The remaining two positions can be any digit from 0 to 9 (excluding 4). So, the number of ways to choose the position for the 4 is 3, and for each position, there are 9 choices for the remaining digits (0-9 excluding 4). Therefore, the total count of numbers with at least one 4 is 3 * 9 * 9 = 243.

Step 2: Count the numbers that contain at least one 9.
Using the same logic as in Step 1, we can choose one position to place the 9 out of the 3 digits. The remaining two positions can be any digit from 0 to 9 (excluding 9). So, the number of ways to choose the position for the 9 is again 3, and for each position, there are 9 choices for the remaining digits (0-9 excluding 9). Therefore, the total count of numbers with at least one 9 is also 3 * 9 * 9 = 243.

Step 3: Count the numbers that contain both 4 and 9.
Here, we need to choose one position to place the 4 and one position to place the 9 out of the 3 digits. The remaining position can be any digit from 0 to 9 (excluding both 4 and 9). So, the number of ways to choose the position for the 4 is 3, and similarly for the 9. For the remaining position, there are 8 choices (0-9 excluding 4 and 9). Therefore, the total count of numbers with both 4 and 9 is 3 * 3 * 8 = 72.

Step 4: Apply the principle of inclusion-exclusion.
To get the count of numbers that contain at least one 4 or one 9 (or both), we need to sum up the counts from Step 1 and Step 2, and then subtract the count from Step 3 to avoid double counting. So, the final count is 243 + 243 - 72 = 414.

Therefore, there are 414 positive integers less than 1000 that contain at least one 4 or at least one 9 (or both).