Chef Nidhi is up for the challenge again (see here ) and his employees are starting to wonder when he can pull it off.
So the employees set up forks and spoons in a row on a table. They can choose whichever line-up of forks and spoons. Next Chef Nidhi must pick consecutive utensils so that there is an equal number forks and spoons (that is forks and spoons).
Consecutive utensils means he could (in an example with ) he may pick the , , and utensils, but he may not pick , , and .
Question: Assume . For which value of and can Chef Nidhi, however the employees laid the utensils, always find forks and spoons which are consecutive?
Hint: Look at the small values of first...
Examples : Below is an example with and . The employees laid out 5 forks and 5 spoons in some order. Then, Chef Nidhi has to pick 8 utensils leaving no gap between the utensils he picks.
The chosen utensils are marked in red. Chef Nidhi could also have chosen the eight leftmost utensils. He could not have chosen the eight utensils in the middle (more spoons than forks). Any other choice would have violated the rule (because these are the only 3 cases where the utensils are in a row). Could the employees use another set up so that Chef Nidhi would not have been able to select the utensils?
Yet another example with and :
Again there is another choice (take the second, third, fourth and fifth utensil). But that's it. Again: could the employees use another set up so that Chef Nidhi would not have been able to select the utensils?
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.
Here is how to get tot the right answer by elimination.
When k = n − 1 there are only 3 possible choices for Chef Nidhi: he take the 2 k leftmost utensils, the 2 k rightmost utensils or the 2 k utensils in the middle. Now if the 2 leftmost and rightmost utensils are spoons, then Chef Nidhi is stuck: he will have to pick all the forks and leave two spoons out, leaving an unbalanced set. However this does not work for n = 3 (because there are only 3 spoons).
So far: k = n − 1 doesn't work when n ≥ 4 . This rules out one answer: "for any k ≤ n ",
However this does not work for n = 3 (because there are only 3 spoons). If the two utensils at the end are different (F----S), then Chef Nidhi picks the bunch in the middle. So we may assume that the utensils at the end are both spoons (S----S). Next if two spoons are at one end (SS---S or S---SS), then he may pick all utensils from this end (because the 3 utensils in the middle are forks: SSFFFS or SFFFSS). So we have at both ends a fork and a spoon (SF--FS). Hence the two middle utensils are also a fork and a spoon, so he may pick all utensils from some end.
So the trick works for k = 2 and n = 3 . So this rules out the remaining answers: "Exactly when k = n − 1 ", "Exactly when k divides n " and "Exactly when k ≤ 2 n or k = n ".
Hence the only remaining answer is \fbox{"Exactly when \$k \leq \frac{n+1}{2}\$ or \$k=2\$"}
General proof?
I don't believe there is a general method to find the pairs ( k , n ) where the trick works. But here are some facts.
So the easiest part is to check that k = n always work since Chef Nidhi can simply pick up all the utensils.
The next easiest thing to do is come up with a line-up in which Chef Nidhi fails. This set up is ⌈ 2 n ⌉ spoons then n forks then ⌊ 2 n ⌋ spoons. If k > ⌈ 2 n ⌉ and k ≤ 2 1 ( n + ⌈ 2 n ⌉ ) , one sees that Chef Nidhi can pick at most ⌈ 2 n ⌉ spoons; which is not enough. If k > 2 1 ( n + ⌈ 2 n ⌉ ) and k < n , he will pick all the forks (and hence not enough spoons).
Here is another family of counterexamples. Assume n = j a = ( j + 1 ) b where a and b are even and j is some integer. Then the line-up b forks, a spoons, b forks, a spoons, .... , b forks, a spoons and b forks, will leave Chef Nidhi stuck if k = 2 1 ( a + b ) .
The first nice example in this family is FFFFSSSSSSFFFFSSSSSSFFFF. This shows the trick does not work for n = 1 2 and k = 5 . This example can be modified to show the trick does not work for n = 1 4 and k = 6 as well as n = 1 5 and k = 6 (and perhaps other, I did not check).
Here is an argument which show the trick indeed works:
Let f ( k ) = + 1 if the k th utensils is a fork and − 1 if it is a spoon. Then consider g ( i ) = j = i ∑ i + 2 k − 1 f ( j ) . We need to show that g ( x ) = 0 for some x ∈ [ 1 , 2 n − 2 k + 1 ] . Note that g take values in the even integers and that either g ( x + 1 ) = g ( x ) or g ( x + 1 ) = g ( x ) ± 2 . So the main ingredient is to show that for some i 0 , g ( i 0 ) < 0 and for some i f , g ( i f ) > 0 . Then by the "intermediate value theorem" one has that some i between i 0 and i f has g ( i ) = 0 .
The case k divides n is then done since g ( 1 ) + g ( 2 k + 1 ) + … + g ( 2 n − 2 k 1 + 1 ) = ∑ i = 1 2 n f ( i ) = 0 . This means that one of the member on the left hand side is < 0 and another is > 0 (that is unless they are all 0, in which case we are done anyway).
So far I could only check the remaining cases k ≤ 2 n + 1 and n ≤ 1 1 by writing a small program. It turns out the trick always work for k ≤ 7 and n = 1 3 .