# How many 8-bit strings have at least two consecutive 0’s or 1’s?

Permutations are the many configurations of a given number of components, either by picking one after the other, part of them, or all of them at once. They are the process of assigning a linear sequence to the constituents of a series. The process of re-ordering the elements of a particular sequence or series is also known as re-ordering. To put it another way, permuting a sequence entails making a list of all alternative arrangements for that sequence. For instance, the sequence 1, 2 can be expressed in two different ways: 1, 2 or 2, 1.

**Permutation Formula**

When r number of items are arranged out of n elements in a particular sequence, the number of permutations is,

^{n}P_{r}= n! / (n – r)!For example, let n = 5 and r = 2. The number of permutations is

^{5}P_{2}= 5! / (5 – 2)! = 20.

**Combinations**

It is described as the process of choosing one, two, or a few elements from a given sequence, independent of the order in which they appear. If you pick two components from a series that only contains two elements to begin with, the order of those elements won’t matter.

**Combination Formula**

When r items are chosen from n elements in a sequence, the number of combinations is

^{n}C_{r}= n! / r! (n – r)!For example, let n = 5 and r = 2, then the number of ways to choose two components from a set of five =

^{5}C_{2}= 5! / 2! (5 – 2)! = 10.

It’s worth mentioning that if a r number of combinations are to be obtained from a collection of n components, and such elements can be repeated, then

^{n+r−1}C_{r}=^{n+r−1}C_{n−1}.

### How many 8-bit strings have at least two consecutive 0’s or 1’s?

**Solution:**

An 8 bit string could represent all numbers between 0 and 2

^{8}= 256.Two consecutive zeroes can start at position 1, 2, 3, 4, 5, 6 or 7.

Starting at position 1: Strings of the form [0 0 x x x x x x]

Remaining 6 places can be arranged in 2

^{6 }= 64 ways.Starting at position 2: Strings of the form [ 1 0 0 x x x x x]

Remaining 5 places can be arranged in 2

^{5}= 32 ways.Similarly, the count for positions 3, 4, 5, 6 and 7 comes to be 32 each.

Number of ways = 64 + 32 + 32 + 32 + 32 + 32 + 32 + 32 – 10

= 246

Also number of strings that start with 2 consecutive 1’s = 246

Thus required value = 246 + 246 = 492

**Similar Problems**

**Question 1. How many binary strings of length 5 have exactly two 1’s somewhere in the string?**

**Solution:**

Note that the order of the bit is not important in this case because we are concerned with the number of ones in the said string and not their order. Thus, we need to apply the concept of combinations to find the required value.

Here, n = 5 and r = 2.

C(5, 2) =

= 10

So there are 10 bit strings of length 5 with exactly two 1’s in them.

**Question 2. Find the number of ways in which a committee of five persons can be formed if they are to be selected from a group of 7 men and 6 women, so as to have at least 3 men on there.**

**Solution:**

At least three men on the committee means we can have either exactly three, four or all five men in the committee.

Number of arrangements when there are 3 men and 2 women on the committee = (

^{7}C_{3}x^{6}C_{2}) = 525Number of arrangements when there are 4 men and 1 woman on the committee= (

^{7}C_{4}x^{6}C_{1}) = 210Number of arrangements when there are all 5 men on the committee = (

^{7}C_{5}) = 21Total arrangements = 525 + 210 + 21

= 756

**Question 3. Find the number of arrangements of the letters of the word ‘LEADING’ where the vowels always appear together?**

**Solution:**

If the vowels are to appear together, they would form a separate letter in the word. Hence we are left with 4 + 1 = 5 letters, which can be arranged in 5! = 120 ways.

Furthermore, there are 3! = 6 ways to arrange the vowels together.

Total number of ways of arranging the letters = 120 x 6 = 720.

**Question 4. Find the number of words having 4 consonants and 3 vowels which can be formed out of 8 consonants and 5 vowels.**

**Solution:**

Number of ways of selecting 4 consonants out of 8 and 3 vowels out of 5 =

^{8}C_{4}x^{5}C_{3}=

= 70 × 10 = 700

Number of ways of arranging the 7 letters among themselves = 7! = 5040

Number of words that can be formed = 5040 × 700 = 3528000.

**Question 5. How many four-letter words can be made out of the word ‘GEEKSFORGEEKS’ if repetition is not allowed?**

**Solution:**

Since there are 7 different letters in the word ‘GEEKSFORGEEKS’

Required number of words =

^{7}P_{4}= 7! / 3!

= 840

**Question 6. Find the number of combinations a piggy bank contains, of nickels, dimes, and quarters given that it has 20 coins in it.**

**Solution:**

Clearly order of the coins does not matter in this question. Also there is no mention as to whether repetition is allowed or not.

Following the rule, there are in case of r number of combinations from a sequence having n number of elements where elements can be repeated

^{n+r−1}C_{r }=^{ n+r−1}C_{n−1}, we have:Number of combinations =

^{20+3-1}C_{20}=^{ 22}C_{20}= 22! / (22 – 20)! 20!

= 11 × 21

= 231

**Question 7. Tell the number of ways for assigning 7 students on a college trip given that we have 1 triple and 2 double rooms.**

**Solution:**

This problem can be interpreted as having to put the 7 students into groups of 3, 2 and 2.

Number of ways to choose 3 students in the triple =

^{7}C_{3}= 7! / 3!4! = 35Number of ways to choose 2 out of the remaining 4 students =

^{4}C_{2}= 4!/ 2!2! = 6Number of ways to choose 2 students out of the remaining two students = 1

Total number of arrangements = 35 × 6 × 1 = 210.

Hence, 7 students can be assigned to 1 triple and 2 double hotel rooms during a conference in 210 ways.

## Please

Loginto comment...