2
$\begingroup$

Count the number of sets of $3$ integers from $\{1, 2, \ldots , 30\}$ if no two consecutive numbers can be in the same set.

So far I understand that there are $^nC_k$ sets of $k$ numbers given the initial set of $n$ numbers. So

the number of sets that contain no consecutive numbers $=$

$$^nC_k - [\# \text{sets w/ $2$ consecutive numbers}] - [\#\text{ sets w/ $3$ consecutive numbers}] - \ldots - [\# \text{sets w/ $n$ consecutive numbers}].$$

But I am not sure how to go about finding the sets.

$\endgroup$

5 Answers 5

4
$\begingroup$

First, your reasoning

the number of sets that contain no consecutive numbers = nCk - [# sets w/ 2 consecutive numbers] - [# sets w/ 3 consecutive numbers] - ... - [# sets w/ n consecutive numbers]

is wrong in general, you're very likely to subtract sets twice if you don't specifically define your sets of sets to be disjoint. When would you subtract the set $\{1,2,14,15,16,22,23,24\}$ and how often? Once you end up making sure you don't have duplicates, your sets are actually harder to count than before.

But there's a much simpler way to count your set. Consider the sets of three integers $\{a,b,c\}$ in $\{1,...,30\}$ such that $a < b < c$ and none of $a,b,c$ are consecutive. Then $\{a,b-1,c-2\}$ is a set of three distinct integers in $\{1, \ldots, 28\}$. Note that each set of three distinct integers can be achieved this way exactly once. So the number you're looking for is equal to the number of sets of three distinct integers in $\{1, \ldots, 28\}$, which you probably know how to work out.

$\endgroup$
1
$\begingroup$

Let the middle element be $i$ which can range over the values $3$ to $28$ and consider the range of values the first and last elements can be gives \begin{eqnarray*} \sum_{i=3}^{28} (i-2)(29-i). \end{eqnarray*} Which is easy to calculate.

$\endgroup$
1
$\begingroup$

Any admissible selection of three integers in $[1\,..\,30]$ can be encoded as a binary word $w$ of length $30$, containing $3$ ones, whereby the first two ones have a zero immediately after. Deleting these zeros gives you a binary word $w'$ of length $28$, containing $3$ ones. Conversely, given a binary word $w'$ of length $28$, containing $3$ ones, introduce a zero after the first two ones, and obtain an admissible word $w$ of length $30$ containing $3$ ones. It follows that the number of admissible words $w$ is equal to the number of admissible words $w'$, which is ${28\choose3}$.

$\endgroup$
0
$\begingroup$

Method 1: We use the Inclusion-Exclusion Principle.

There are $\binom{30}{3}$ ways to select three of the thirty numbers in the set $\{1, 2, 3, \ldots, 30\}$. From these, we must subtract those selections in which two or more of the selected numbers are consecutive.

A pair of consecutive numbers is selected: Since the smaller number in the pair can be at most $29$, there are $29$ ways to select the smaller number in the pair. Doing so also determines the larger number in the pair. That leaves $28$ ways to select the third number. Thus, there are $29 \cdot 28$ ways to select three numbers from the set so that the selected numbers include a pair of consecutive numbers.

However, if we subtract this amount from the total, we will have subtracted each case in which there are three consecutive numbers twice, once when we designate the two smallest numbers as our pair of consecutive numbers and once when we designate the two largest numbers as our pair of consecutive numbers. We only want to subtract such cases once, so we must add them back.

Two pairs of consecutive numbers are selected: This can only occur if all three numbers are consecutive. There are $28$ ways to select the smallest of these three numbers, so there are $28$ such cases.

By the Inclusion-Exclusion Principle, the number of ways to select three numbers from the set $\{1, 2, 3, \ldots, 30\}$ so that no two of the three numbers are consecutive is $$\binom{30}{3} - 29 \cdot 28 + 28$$

Method 2: We modify your approach.

There are still $\binom{30}{3}$ ways to select three of the thirty numbers in the set $\{1, 2, 3, \ldots, 30\}$. From these, we must those selections in which there are exactly two consecutive numbers and those cases in which there are exactly three consecutive numbers.

Exactly two consecutive numbers: We consider cases.

If the consecutive numbers are $1, 2$, we can select the third number in $27$ ways since we cannot select $3$.

If the consecutive numbers are $29, 30$, we can select the third number in $27$ ways since we cannot select $28$.

Otherwise, we can select the smaller of the two consecutive numbers in $27$ ways, as it must be greater than $1$ and smaller than $29$. We now have two numbers we are prohibited from selecting as the third number, the one that is one less than the smaller of the consecutive numbers and the one that is one greater than the larger of the consecutive numbers. Hence, we can select the third number in $26$ ways. Thus, there are $27 \cdot 26$ such cases.

Exactly three consecutive numbers: We saw above that there are exactly $28$ such cases.

Hence, there are $$\binom{30}{3} - 2 \cdot 27 - 26 \cdot 27 - 28$$ admissible selections.

Method 3: We line up $27$ blue and three green balls so that no two of the green balls are consecutive, then number the balls from left to right.

Line up $27$ blue balls. This creates $28$ spaces, $26$ between successive blue balls and two at the ends of the row. To ensure no two green balls are adjacent, choose three of these $28$ spaces in which to place a green ball. This can be done in $\binom{28}{3}$ ways. Now number the balls from left to right. Since there is at least one blue ball between each pair of green balls, no two of the numbers on the green balls are consecutive. Hence, the number of ways we can select three numbers from the set $\{1, 2, 3, \ldots, 30\}$ so that no two of the numbers are consecutive is $$\binom{28}{3}$$

You should verify that each of the above methods yields the same count.

$\endgroup$
0
$\begingroup$

Let $N$ denote the number of subsets $S$ of $\{1,2,\ldots,n\}$ s.t. $|S|=m$ and for any two distinct elements $i$ and $j$ of $S$, $|i-j|> d$. Here $n$, $m$, and $d$ are non-negative integers. Suppose $S=\{x_1,x_2,\ldots,x_m\}$ where $x_1<x_2<\ldots <x_m$.

Then define $y_1=x_1$, $y_i=x_i-x_{i-1}-d$ for $i=2,3,\ldots,m$, and $y_{m+1}=n+1-x_{m}$. Then each $y_i$ is a positive integer and $$y_1+y_2+\ldots+y_{m+1}=(n+1)-d(m-1)=n-dm+d+1.$$ Using the stars-and-bars technique, the number of positive integer solutions $(y_1,y_2,\ldots,y_m,y_{m+1})$ to the equation above is known to be $$\binom{(n-dm+d+1)-1}{(m+1)-1}=\binom{n-dm+d}{m}.$$ That is $N=\binom{n-dm+d}{m}$ (clearly if $n<dm-d+m$, then $N=0$). In particular when $n=30$, $m=3$, and $d=1$, the answer is $$N=\binom{30-1\cdot 3+1}{3}=\binom{28}{3}=3276.$$

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .