Eagerissac
New member
- Joined
- Jan 9, 2020
- Messages
- 16
So I'm trying to calculate the number of valid decimal-strings under certain conditions related to the product rule, and was hoping for some clarification. I have a copy and paste solution from my teacher for a similar question below, and I was basing my solution of #2 off of that but I can't seem to get the formula right. I would really appreciate some help.
GIVEN QUESTION:
A decimaI-string is a sequence of characters consisting of {0,1,2,3,4,5,6,7,8,9}.
Etc:
0
3463412398
Let n≥0 be an integer.
1. Calculate the number of decimaI-strings of Iength n.
So I know the answer to this is 10^n
2. Calculate the number of decimal-strings d1,…,dn of length n such that d1d2≠00 and d2d3≠01?
Following my teacher's example below, I counted 981 valid decimal-strings when n = 3. However, when I tried to test the formula I got for n = 4, I counted 9801 decimal strings when the formula should give me 9810 valid decimal-strings. I re-counted the valid strings from each length multiple times, but I can't get the formula to work for n>= 4. I was wondering if someone could explain what I'm doing wrong?
981 x 10^(n-3)
3. Calculate the number of decimal-strings d1,…,dn of length n such that d1d2=00 or d1d2d3=111
This one I'm a little confused as to how the "or" would change my calculations and was hoping for some help.
-------------------------------------
TEACHER'S SOLUTION FOR SIMILAR QUESTION THAT I WAS BASING MY WORK OFF OF:
An n-bit binary string is a sequence of length n over the alphabet {0,1}.
1. How many n-bit binary strings are there?
2^n
2. How many n-bit binary strings b1,…,bn are there such that b1b2≠00 and such that b2b3≠01?
These are the valid choices of b1b2b3: {011, 010, 100, 110, 111}. (The invalid choices are {000, 001, 101}.) After choosing b1b2b3 we have 2 choices for each of b4, . . . , bn. Therefore, by the Product Rule, the number of strings we are interested in is
5 × 2^(n−3)
GIVEN QUESTION:
A decimaI-string is a sequence of characters consisting of {0,1,2,3,4,5,6,7,8,9}.
Etc:
0
3463412398
Let n≥0 be an integer.
1. Calculate the number of decimaI-strings of Iength n.
So I know the answer to this is 10^n
2. Calculate the number of decimal-strings d1,…,dn of length n such that d1d2≠00 and d2d3≠01?
Following my teacher's example below, I counted 981 valid decimal-strings when n = 3. However, when I tried to test the formula I got for n = 4, I counted 9801 decimal strings when the formula should give me 9810 valid decimal-strings. I re-counted the valid strings from each length multiple times, but I can't get the formula to work for n>= 4. I was wondering if someone could explain what I'm doing wrong?
981 x 10^(n-3)
3. Calculate the number of decimal-strings d1,…,dn of length n such that d1d2=00 or d1d2d3=111
This one I'm a little confused as to how the "or" would change my calculations and was hoping for some help.
-------------------------------------
TEACHER'S SOLUTION FOR SIMILAR QUESTION THAT I WAS BASING MY WORK OFF OF:
An n-bit binary string is a sequence of length n over the alphabet {0,1}.
1. How many n-bit binary strings are there?
2^n
2. How many n-bit binary strings b1,…,bn are there such that b1b2≠00 and such that b2b3≠01?
These are the valid choices of b1b2b3: {011, 010, 100, 110, 111}. (The invalid choices are {000, 001, 101}.) After choosing b1b2b3 we have 2 choices for each of b4, . . . , bn. Therefore, by the Product Rule, the number of strings we are interested in is
5 × 2^(n−3)