- #1
Nick O
- 158
- 8
Homework Statement
How many strings of five ASCII characters contain the character @ ("at" sign) at least once? [Note: there are 128 different ASCII characters.]
Homework Equations
The rule of product and inclusion-exclusion principle are relevant.
The Attempt at a Solution
The correct solution is as follows:
The number of 5-character ASCII strings is 128^5. The number of 5-character ASCII strings not including at least one @ is 127^5. By the inclusion-exclusion principle, the number of 5-character ASCII strings including at least one @ is equal to 128^5 - 127^5.
I have no problem with that. What bothers me is that I can't find out where I go wrong with the following "solution", which yields a different answer.
Incorrect solution:
At least one of the five characters is an @. There are 5 ways to place this character, because the string has a length of 5. The remaining characters may or may not be an @ symbol. Each of the four remaining characters can be chosen in 128 different ways.
By the rule of product, there are 5 * 128 * 128 * 128 * 128 = 5*128^4 such strings.
Query:
128^5 - 127^5 is a much larger number than 5*128^4. Which assumption in my incorrect solution is unjustified?