How Many 5-Character Strings Include At Least One '@' Symbol?

  • Thread starter Thread starter duke_nemmerle
  • Start date Start date
  • Tags Tags
    Counting Strings
AI Thread Summary
To determine the number of 5-character strings containing at least one '@' symbol, the correct approach is to calculate the total number of strings (128^5) and subtract those that do not include the '@' (127^5). The flawed reasoning arises from assuming that placing the '@' in one of the five positions and filling the remaining four with any characters (5 * 128^4) accounts for all possibilities. This method overcounts strings with multiple '@' symbols, as they can be arranged in various ways that are not captured by simply multiplying. The correct calculation ensures that all cases, including those with multiple occurrences of '@', are accurately represented.
duke_nemmerle
Messages
50
Reaction score
1

Homework Statement

Given that the ASCII character system has 128 possible characters how many 5 character strings are there with at least one occurence of the '@' symbol.



Homework Equations





The Attempt at a Solution


So clearly which symbol we're using doesn't matter, and I see that the right answer comes from considering the total number of length 5 character strings minus the number of strings not containing the '@' character i.e. 128^5-127^5.

My real question is what is wrong with the reasoning that we have 5 choices for where to put the '@' symbol multiplied by the 128^4 possible strings from the other 4 characters. I can see that 128^5-127^5 \not= 5(128^4), but I'm wondering where the flaw in the reasoning is
 
Physics news on Phys.org
duke_nemmerle said:

Homework Statement

Given that the ASCII character system has 128 possible characters how many 5 character strings are there with at least one occurence of the '@' symbol.



Homework Equations





The Attempt at a Solution


So clearly which symbol we're using doesn't matter, and I see that the right answer comes from considering the total number of length 5 character strings minus the number of strings not containing the '@' character i.e. 128^5-127^5.

My real question is what is wrong with the reasoning that we have 5 choices for where to put the '@' symbol multiplied by the 128^4 possible strings from the other 4 characters. I can see that 128^5-127^5 \not= 5(128^4), but I'm wondering where the flaw in the reasoning is

I think I've figured it out by considering a much smaller alphabet and character length. I was obviously overcounting, but now I see that I'm counting the strings with more than one instance of the character several times each.
 
I tried to combine those 2 formulas but it didn't work. I tried using another case where there are 2 red balls and 2 blue balls only so when combining the formula I got ##\frac{(4-1)!}{2!2!}=\frac{3}{2}## which does not make sense. Is there any formula to calculate cyclic permutation of identical objects or I have to do it by listing all the possibilities? Thanks
Essentially I just have this problem that I'm stuck on, on a sheet about complex numbers: Show that, for ##|r|<1,## $$1+r\cos(x)+r^2\cos(2x)+r^3\cos(3x)...=\frac{1-r\cos(x)}{1-2r\cos(x)+r^2}$$ My first thought was to express it as a geometric series, where the real part of the sum of the series would be the series you see above: $$1+re^{ix}+r^2e^{2ix}+r^3e^{3ix}...$$ The sum of this series is just: $$\frac{(re^{ix})^n-1}{re^{ix} - 1}$$ I'm having some trouble trying to figure out what to...
Back
Top