Consider the set A = { 1 , 2 , 3 , 4 , . . . . . , 1 5 } . How many subsets of A are there in which no two elements have a difference less than 3 ?
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.
Imagine a strip of 1 7 squares numbered 1 , 2 , 3 , … , 1 7 , where we put n blocks that cover 3 squares each, and write the smallest number that it covers on top of it. Then no two of these "block numbers" have difference less than 3 and all of them are taken from { 1 , 2 , … , 1 5 } , since 1 6 , 1 7 cannot appear (if they appear, then a smaller number must be covered by the block and thus the block doesn't show the smallest number it covers, contradiction), and hence the blocks numbers form a subset that satisfies the asked property. In addition, if we know the block numbers, we can construct the unique configuration of blocks, thus we have a bijection between subsets of A with n elements that have the desired property and configurations of n blocks.
Now, to count the number of possible configurations, we can imagine that we put smaller blocks that cover 1 square each for the uncovered squares. Thus we have n large, 3-square blocks, and 1 7 − 3 n small, 1-square blocks. There are clearly ( n n + ( 1 7 − 3 n ) ) = ( n 1 7 − 2 n ) configurations of these blocks, and since we have a bijection, there are also ( n 1 7 − 2 n ) satisfying subsets of n elements.
Clearly 0 ≤ n ≤ 5 ; for n > 5 , we have a negative number of 1-square blocks, and for n < 0 , we have a negative number of 3-square blocks. Thus add up ( n 1 7 − 2 n ) for 0 ≤ n ≤ 5 :
n = 0 ∑ 5 ( n 1 7 − 2 n )
= ( 0 1 7 ) + ( 1 1 5 ) + ( 2 1 3 ) + ( 3 1 1 ) + ( 4 9 ) + ( 5 7 )
= 1 + 1 5 + 7 8 + 1 6 5 + 1 2 6 + 2 1 = 4 0 6
Done the same way.
In this case,maximum number of elements that can be selected is 5 at a time.
Now imagine that we have selected those 5 elements with the required conditions and number of elements not chosen between any two elements is x i .
Then x 1 + x 2 + x 3 + x 4 + x 5 + x 6 =10 (Here, x 1 are the leading elements and x 6 are trailing elements)
Now x 2 , x 3 , x 4 , x 5 are minimum 2 then
Let
x 2 -2=w
x 3 -2=x
x 4 -2=y
x 5 -2=z
We`ll get x 1 +w+2+x+2+y+2+z+2+ x 6 =10 and hence,
x 1 +w+x+y+z+ x 6 =2
where w,x,y,z can be 0.Now,this has turned to standard Ball-and-urn problem whose solution is ( 2 + 6 − 1 2 ) =21 Similarly,we`ll take case with 4 elements ,3 elements,2 elements,1 element and get
( 2 + 6 − 1 2 ) + ( 5 + 5 − 1 5 ) + ( 8 + 4 − 1 8 ) + ( 1 1 + 3 − 1 1 1 ) + ( 1 4 + 2 − 1 1 4 )
=21 +126+165+78+15=405
And we add 1 for null set
⟹ 4 0 5 + 1 = 4 0 6
Intuitive C++ program:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
Problem Loading...
Note Loading...
Set Loading...
We can use recurrence relations to solve this problem.
Let a n be the number of subsets of { 1 , 2 , . . . , n } in which no two elements have a difference less than 3 . We then have two cases to look at to set up the recurrence relation:
(i) for subsets that exclude n we have ( n − 1 ) consecutive elements remaining to choose from, giving us a n − 1 subsets;
(ii) for subsets that include n we must exclude ( n − 1 ) and ( n − 2 ) , but we can include any of the other ( n − 3 ) consecutive elements remaining, giving us a n − 3 subsets.
So we have the recurrence relation a n = a n − 1 + a n − 3 , which only makes sense for n > 3 . It is clear, though, that a 1 = 2 , a 2 = 3 and a 3 = 4 . Using these seed values and the relation we can fairly quickly work our way up the sequence to find that a 1 5 = 4 0 6 .
(We might want to find a closed-form formula if we want to deal with large n , but for n = 1 5 it was easy enough to just to work our way up the sequence one at a time.)