How many 8 bit strings either start with a 1 or end with a one?
How many 8 bit strings either start with 100 or have the fourth bit a 1?
I know that the answer is 2^5 + 2^7 - 2^4 The first term is the number of strings with 100 the second term is the number of strings with 1 as 4th bit but why is 2^4 the number in which both occur??? Is it simply that there are 2^4 ways to choose four positions???? Thank you all for looking and trying to help my old brain think in new ways.
Hello, Frostking!
Maybe my baby-talk approach will help your "old brain".
. . (I bet my brain is older than yours.)
How many 8-bit strings either start with a 1 or end with a 1?
If it starts with 1, it is of the form: .
. . The blanks can be filled in ways.
If it ends with 1, it is of the form: .
. . The blanks can be filled in ways.
But there are numbers that start and end with 1,
. . and we have counted them twice.
These numbers have the form: .
. . The blanks can be filled in ways.
Therefore, the number is: .
How many 8-bit strings either start with 100 or have the fourth bit a 1?
If it starts with 100, it is of the form: .
. . The blanks can be filled in ways.
If the fourth digit is 1, it is of the form: .
. . The blanks can be filled in ways.
But there are numbers that begin with 100 and whose 4th digit is 1,
. . and we have counted them twice.
These numbers are of the form: .
. . The blanks can be filled in ways.
Therefore: .
Thank you very much!!! With that explanation I think I can do just about any bit problem that is given to me. I appreciate your being willing to explain it at such a basic level and stating it so clearly. You do have me in age but not by much!! Have a great day!