No Two Consecutive Number

How many 3-element subset from a set A = { 1 , 2 , 3 , . . . , 25 } A=\{1,2,3,...,25\} such that the subset does not have two consecutive number. For any subset { a 1 , a 2 , a 3 } \{a_1, a_2, a_3\} ; a i a j 1 |a_i-a_j|\ne1


The answer is 1771.

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.

2 solutions

Kyle T
Apr 9, 2019

<?php
$t=0;
for($a=1;$a<=21;$a++){
for($b=$a+2;$b<=23;$b++){
for($c=$b+2;$c<=25;$c++){
$t++;
}
}
}
echo $t;
?>


Some quick and dirty loops gave me the correct answer, basically my theory was $a will always be the lowest number, $b will be the middle number and must be at least 2 greater than $a, and $c will be the highest number and must be 2 greater than $b.
$t just acts as a total and when we print it at the end it gives us our answer 1771

Achmad Damanhuri
Apr 9, 2019

We look at the problem as a biner with the length of 25 25 . a 1 a 2 a 3 a 25 a_1a_2a_3\cdots a_{25} With a i a_i is either 1 1 or 0 0 and we denote ( 1 = a i 1=a_i choosen) or ( 0 = a i 0=a_i not choosen) So We will put these 22 22 number 0 0 first, then we will choose the position of number 1 1 between these 0 0 so that there’s no two consecutive number will be selected. + 0 + 0 + 0 + + 0 + 0 + 0 + +0+0+0+\cdots+0+0+0+ The answer is C 3 23 = 1771 C^{23}_3=1771

Slight problem - C 3 22 = 1540 C^{22}_3=1540 .

Chris Lewis - 2 years, 2 months ago

Ya it should be 23C3

Mr. India - 2 years, 2 months ago

My mistake, Thank you

Achmad Damanhuri - 2 years, 2 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...