Set theory!

S = { 1 , 2 , 3 , , 19 , 20 } \large \displaystyle S = \{{1,2,3,\ldots, 19,20}\}

How many subsets of three numbers each can be formed from the set above so that no two consecutive numbers are in the set?


The answer is 816.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

11 solutions

Rohit Ner
Jun 1, 2015

Consider a triplet ( a , b , c ) (a,b,c) where a a , b b and c c are in ascending order, be transformed to ( a , b + 1 , c + 2 ) (a,b+1,c+2) . This will eliminate the chances of occurrence of any consecutive numbers.
c + 2 20 c 18 c+2\le 20\Rightarrow c\le 18 .
Hence, we are free to choose any triplet ( a , b , c ) (a,b,c) where a a , b b and c c are in ascending order, from the first 18 18 numbers. These will be transformed as mentioned above to avoid two consecutive numbers in the triplet.
Number of ways to choose 3 3 numbers from these 18 18 numbers is ( 18 3 ) \dbinom{18}{3} = 816 \huge = \boxed{816}


I prefer a straight (no trick) way of calculation: Total number of choosing 3 from 20 is: ( 20 3 ) {20 \choose 3} . Out of them, we count the ones that have just 1 consecutive numbers:

- For the ones that have exactly one pair of consecutive numbers: The pair of consecutive numbers can be chosen from any 19 cases. Out of these 19 cases:

In 2 cases, the consecutive numbers are at the edge. In each such case, once the first 2 numbers are chosen, we have 17 numbers left to be the 3rd number, because 1 number out of the 18 numbers is neighboring with the consecutive numbers. That is: 17 2 17*2

In other 17 cases, the 3rd number can be chosen from any number of the 16 eligible choices. That is: 17 16 17*16

- For the ones that have two pair of consecutive numbers, we have 17 possible choices.

So the answer to the original question is: ( 20 3 ) 17 2 17 16 17 = ( 20 3 ) 17 19 = 1140 323 = 817 {20 \choose 3} - 17*2 - 17*16 - 17 = {20 \choose 3}-17*19 = 1140-323 = 817

Where did I make a mistake?

林晓 耿 - 5 years, 6 months ago

Log in to reply

You said, "For the ones that have two pair of consecutive numbers, we have 17 possible choices."

The lowest number of the two pair can be from 1 to 18. (18, 19, 20) is the missing triple that gets you from 817 to 816!

Best wishes! ;^)

Larry Paden - 5 years, 5 months ago

I still do not understand it. Please explain further.

Saurabh Chaturvedi - 5 years ago

Great trick. Your solution would be a bit easier to read if you spelled out that your way of picking triplets from 1 to 18 indeed does produce 1-1 all the legal ways to pick from 1 to 20. That is, that your transformation is bijective. It's easy to check, but the reader is left to wonder about it.

Dagh Nielsen - 4 years, 6 months ago

I misread the question. Didn't see the "of three numbers" part. No wonder I produced an answer of astronomical proportions lol

Brody Burkett - 3 years ago

Impressive!

Manuel Antonio Castro Pérez - 1 year, 4 months ago

Nice solution

Vimal Khetan - 1 year, 2 months ago
Patrick Chatain
May 23, 2016

We will count the opposite, that is, the total number of sets such that there are at least 2 2 consecutive numbers:

Now these pairs of consecutive numbers can be ( 1 , 2 ) , ( 2 , 3 ) , , ( 19 , 20 ) (1,2), (2,3), \ldots , (19, 20) so we have 19 19 options and then to select the final number we have another 18 18 options. So 19 × 18 = 342 19 \times 18 = 342 . However we counted twice the subsets where the three numbers are consecutive (i.e. the set ( 4 , 5 , 6 ) (4,5,6) was counted when taking into account the pair ( 4 , 5 ) (4,5) and the pair ( 5 , 6 ) (5,6) ) so we need to subtract the number of subsets such that all the numbers are consecutive. These are ( 1 , 2 , 3 ) , ( 2 , 3 , 4 ) , , ( 18 , 19 , 20 ) (1,2,3), (2,3,4), \ldots, (18,19,20) so there are 18 18 of them. So we have 342 18 = 324 342 - 18 = 324 subsets such that at least two numbers are consecutive.

Therefore the number of subsets such that no two numbers are consecutive is ( 20 3 ) 324 = 816 \binom{20}{ 3} - 324 = 816

Great explanation, Patrick! Nice use of principle of inclusion and exclusion (PIE) . I upvoted your solution (+1)

Pranshu Gaba - 5 years ago

I did it in the same way.

Prayas Rautray - 3 years, 11 months ago
Lee Isaac
Jun 3, 2015

Let a<b<c be the 3 numbers. Choose a first, then b, then c. When you choose a, a+1 can't be chosen for b or c. When you choose b, b+1 can't be chosen for c. Thus, we only have 18 numbers to choose from, every time we choose a triplet.

The number of ways to choose 3 objects from 18 is 18C3=816

Answer: 816

To me, this seems to be the clearest and most concise solution! Thank you for posting it! ;^)

Larry Paden - 5 years, 5 months ago
Aswin T.S.
Mar 17, 2016

Number of ways can be triplet formed with starting number 1 =

16+15+14+13+12+11+10+9+8+7+6+5+4+3+2+1 =136 ways

Number of ways can be triplet formed with starting number 2=

 15+14+13+12+11+10+9+8+7+6+5+4+3+2+1 =120 ways

Number of ways can be triplet formed with starting number 3=

     14+13+12+11+10+9+8+7+6+5+4+3+2+1 =105 ways

Number of ways can be triplet formed with starting number 4 =

          13+12+11+10+9+8+7+6+5+4+3+2+1 =91  ways

Number of ways can be triplet formed with starting number 5 =

                12+11+10+9+8+7+6+5+4+3+2+1 =78 ways

Number of ways can be triplet formed with starting number 6 =

                      11+10+9+8+7+6+5+4+3+2+1=66 ways

Number of ways can be triplet formed with starting number 7=

                          10+9+8+7+6+5+4+3+2+1  =55 ways

Number of ways can be triplet formed with starting number 8=

                            9+8+7+6+5+4+3+2+1 =45 ways

Number of ways can be triplet formed with starting number 9=

                                  8+7+6+5+4+3+2+1 =36  ways

Number of ways can be triplet formed with starting number 10=

                                     7+6+5+4+3+2+1 =28  ways

Number of ways can be triplet formed with starting number 11=

                                     6+5+4+3+2+1=21  ways

Number of ways can be triplet formed with starting number 12=

                                        5+4+3+2+1=15 ways

Number of ways can be triplet formed with starting number 13=

                                           4+3+2+1=10 ways

Number of ways can be triplet formed with starting number 14=

                                              3+2+1=6 ways

Number of ways can be triplet formed with starting number 15=

                                                 2+1=3 ways

Number of ways can be triplet formed with starting number 16 =

                                                     1 way

therefore total = 136 + 120 +..................... +1 = 816

There are so many ways to solve this problem. I ended up simply finding the sum of triangular numbers from the Pascal Triangle: S(n)=(1/6) n(n+1)(n+2). For n=16, s(16)= (1/6)(16)(17)(18)= 816. One can come up with n=16 by examining the patterns of possible sets. The largest element these sets can start with is 16, and that set will be {16, 18, 20}. So we can have only one set starting with 16, two sets starting with 15, etc.

I had worked out in the same manner as Pratham Shukla. However I find there are different ways of looking at it.

Ramesh Chandra
Jun 6, 2015

first place 20 box in a row and remove 3 boxes. now remaining 17 has 18 gap so select any 3 gap to put these consecutive number in 18 C 3 ways i.e. 816

Total possible sets is ( 20 C 3) = 1140 Sets wid exactly three elements consecutive = 18. Sets wid exactly two elements consecutive = 2 * 17 {for set (1,2,x) and (x,19,20)} + 17 * 19 = 324. Sets wid no consecutive elements = 1140 - 324 = 816

Pratham Shukla - 6 years ago

What's the use of the boxes if you didn't put anything in them. They feel empty, you know?

Satyo Jena - 9 months ago
Haytham Connor
Oct 2, 2016

Let's consider all the invalid sets. All the sets that for sure are invalid definitely have the format: ( 1 , 2 , x ) , ( 2 , 3 , x ) , ( 3 , 4 , x ) . . . ( 19 , 20 , x ) (1, 2, x), (2, 3, x), (3, 4, x)...(19,20,x) Where x x is some other arbitrary value from the original set. Analyzing our first invalid set from above, we see that there are 18 18 possibilities. Analyzing our next set, there must be 17 17 possibilities (Note: you have to exclude ( 2 , 3 , 1 ) (2,3,1) as this was already counted; this pattern will be true for all of the rest of the sets--exclude the first number from the previous set). We see there is one template with 18 18 impossibilities and 18 18 templates of 17 17 impossibilities gives 18 + 18 ( 17 ) = 324 18 + 18(17) = 324 impossibilities. Given that there are 20 c h o o s e 3 20 choose 3 possiblities, we do ( 20 c h o o s e 3 ) 324 = 816 (20 choose 3) - 324 = 816 , giving us 816 816 valid sets.

Note: I'm new to latex, so apologies for the bad formatting. This solution is practically equivalent to Patrick's.

Eric Kim
Jul 20, 2016

This is similar to the stars and bars problem, where counted objects are generalized into a string.

Here we have 20 20 objects, where 3 3 numbers that are not consecutive must be chosen.

If we write the stars as the other 17 17 objects and the 3 3 chosen objects as bars, we get a variant of the following:

|||********************

However, they cannot be consecutive, so we assume there is at least 1 1 star in between the bars. This lets us reduce the star count by 2 2 :

|||******************

We count the number of ways we can arrange this string, getting ( 18 3 ) {18 \choose 3} , or 816 816 .

https://brilliant.org/wiki/integer-equations-star-and-bars/

Marina Longnickel
Oct 22, 2017

C(20,3)-[(20-1)*(20-2)-18]

There are C(20,3) possible triplets. As for the forbidden triplets, for each (20-1) pairs of adjacent numbers there are (20-2) numbers remaining to complete the triplet. However, we're overcounting by 18, since a forbidden pair can be the first or last two numbers.

Danilo Borovnica
Jun 8, 2016

main()

{
int i,j,k,n,br=0; 
cout << "Enter the number of set members: ";
cin >> n;
for (i=1; i<=n; i=i+1)
{
    for (j=i+2; j<=n; j=j+1)
    {
    for (k=j+2; k<=n; k=k+1)
    {
    br=br+1;
    cout << "    " << br;
    cout << " " << i;
    cout << ", " << j;
    cout << ", " << k;
    cout <<endl;
    }
    }
}

}

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...