Counting strings

  • #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. [tex]128^5-127^5[/tex].

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

Answers and Replies

  • #2

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. [tex]128^5-127^5[/tex].

My real question is what is wrong with the reasoning that we have 5 choices for where to put the '@' symbol multiplied by the [tex]128^4[/tex] possible strings from the other 4 characters. I can see that [tex]128^5-127^5 \not= 5(128^4)[/tex], 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.
 

Related Threads on Counting strings

Replies
2
Views
622
  • Last Post
Replies
3
Views
742
  • Last Post
Replies
3
Views
1K
  • Last Post
Replies
8
Views
3K
  • Last Post
Replies
6
Views
674
  • Last Post
Replies
4
Views
460
  • Last Post
Replies
8
Views
1K
  • Last Post
Replies
2
Views
2K
  • Last Post
Replies
9
Views
1K
Top