Wolves and sheep Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Fastest way to collect an arbitrary armyMiddle weight puzzleA puzzle of trust and lies, allies and spiesCooperative guessing against an evil godDevious auction gameRocks and Lever (Game) - GoofspielMonopoly Game Show: Is there a winning strategy?23 Clones and Two LightbulbsFinding all possible solutions of a japanese sums puzzleBlindfold Bingo
When to stop saving and start investing?
When is phishing education going too far?
Is there a documented rationale why the House Ways and Means chairman can demand tax info?
Does polymorph use a PC’s CR or its level?
Do I really need recursive chmod to restrict access to a folder?
What does '1 unit of lemon juice' mean in a grandma's drink recipe?
Should gear shift center itself while in neutral?
How do I keep my slimes from escaping their pens?
What are 'alternative tunings' of a guitar and why would you use them? Doesn't it make it more difficult to play?
Why is "Consequences inflicted." not a sentence?
Should I discuss the type of campaign with my players?
How discoverable are IPv6 addresses and AAAA names by potential attackers?
How can I make names more distinctive without making them longer?
Do you forfeit tax refunds/credits if you aren't required to and don't file by April 15?
If Jon Snow became King of the Seven Kingdoms what would his regnal number be?
If 'B is more likely given A', then 'A is more likely given B'
What do you call a plan that's an alternative plan in case your initial plan fails?
Is there a Spanish version of "dot your i's and cross your t's" that includes the letter 'ñ'?
What is a Meta algorithm?
What would be the ideal power source for a cybernetic eye?
Did Xerox really develop the first LAN?
Did Kevin spill real chili?
What's the purpose of writing one's academic bio in 3rd person?
What are the motives behind Cersei's orders given to Bronn?
Wolves and sheep
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Fastest way to collect an arbitrary armyMiddle weight puzzleA puzzle of trust and lies, allies and spiesCooperative guessing against an evil godDevious auction gameRocks and Lever (Game) - GoofspielMonopoly Game Show: Is there a winning strategy?23 Clones and Two LightbulbsFinding all possible solutions of a japanese sums puzzleBlindfold Bingo
$begingroup$
All the sheep were living peacefully in the Land of Shewo. But suddenly they were struck by a danger. A few wolves dressed up as sheep entered the territory of Shewo and started killing the sheep one by one.
To find a solution to this misery, the king of Shewo called upon all of his sheep to the palace hall. He made the following announcement:
From my secret sources, I came to know that the total number of 'sheep' (including the wolves) now present in my kingdom is 100. Among which 5 are wolves. Our doctors have come up with a very expensive blood test which could be used to differentiate the wolves and sheep.
Each test costs 1000$ and we don't have enough funds to test all the 100 'sheep'.
I discussed with our ministers and came to know that the tests can be done on pooled bloodsamples. i.e., I can collect bloods from any number of 'sheep' and mix them. Then if I test the mixture, I will get a positive result if the mixture contain blood from any wolf. I will get a negative result if all the samples are from actual sheep.
One caveat is that the test results are available to you after all the tests are done!
Now , I am looking for ideas where I can find ALL the wolves in minimum number of pooled tests. I request the brilliant young minds of this land to come up with a testing strategy.
Can you help the king by devising a strategy?
Hint 1:
Think of total number of ways 5 wolves can infiltrate 95 sheep.
Hint 2:
Think of binary sequences to distinguish each of the possible groups of 5 wolves
strategy combinatorics algorithm
$endgroup$
add a comment |
$begingroup$
All the sheep were living peacefully in the Land of Shewo. But suddenly they were struck by a danger. A few wolves dressed up as sheep entered the territory of Shewo and started killing the sheep one by one.
To find a solution to this misery, the king of Shewo called upon all of his sheep to the palace hall. He made the following announcement:
From my secret sources, I came to know that the total number of 'sheep' (including the wolves) now present in my kingdom is 100. Among which 5 are wolves. Our doctors have come up with a very expensive blood test which could be used to differentiate the wolves and sheep.
Each test costs 1000$ and we don't have enough funds to test all the 100 'sheep'.
I discussed with our ministers and came to know that the tests can be done on pooled bloodsamples. i.e., I can collect bloods from any number of 'sheep' and mix them. Then if I test the mixture, I will get a positive result if the mixture contain blood from any wolf. I will get a negative result if all the samples are from actual sheep.
One caveat is that the test results are available to you after all the tests are done!
Now , I am looking for ideas where I can find ALL the wolves in minimum number of pooled tests. I request the brilliant young minds of this land to come up with a testing strategy.
Can you help the king by devising a strategy?
Hint 1:
Think of total number of ways 5 wolves can infiltrate 95 sheep.
Hint 2:
Think of binary sequences to distinguish each of the possible groups of 5 wolves
strategy combinatorics algorithm
$endgroup$
1
$begingroup$
This is close to a covering design (Lotto wheel) problem.
$endgroup$
– Arnaud Mortier
2 days ago
3
$begingroup$
First of all, does the government have enough funds to test 99 of the sheep? Because that would work, at a cost of $99,000. Congrats, you just saved 1,000 bucks.
$endgroup$
– user45266
yesterday
3
$begingroup$
Alternatively, you know the location of all 5 wolves. Take initiative and slaughter all 100. Now you have no more wolves, and food for a good while to come.
$endgroup$
– user45266
yesterday
add a comment |
$begingroup$
All the sheep were living peacefully in the Land of Shewo. But suddenly they were struck by a danger. A few wolves dressed up as sheep entered the territory of Shewo and started killing the sheep one by one.
To find a solution to this misery, the king of Shewo called upon all of his sheep to the palace hall. He made the following announcement:
From my secret sources, I came to know that the total number of 'sheep' (including the wolves) now present in my kingdom is 100. Among which 5 are wolves. Our doctors have come up with a very expensive blood test which could be used to differentiate the wolves and sheep.
Each test costs 1000$ and we don't have enough funds to test all the 100 'sheep'.
I discussed with our ministers and came to know that the tests can be done on pooled bloodsamples. i.e., I can collect bloods from any number of 'sheep' and mix them. Then if I test the mixture, I will get a positive result if the mixture contain blood from any wolf. I will get a negative result if all the samples are from actual sheep.
One caveat is that the test results are available to you after all the tests are done!
Now , I am looking for ideas where I can find ALL the wolves in minimum number of pooled tests. I request the brilliant young minds of this land to come up with a testing strategy.
Can you help the king by devising a strategy?
Hint 1:
Think of total number of ways 5 wolves can infiltrate 95 sheep.
Hint 2:
Think of binary sequences to distinguish each of the possible groups of 5 wolves
strategy combinatorics algorithm
$endgroup$
All the sheep were living peacefully in the Land of Shewo. But suddenly they were struck by a danger. A few wolves dressed up as sheep entered the territory of Shewo and started killing the sheep one by one.
To find a solution to this misery, the king of Shewo called upon all of his sheep to the palace hall. He made the following announcement:
From my secret sources, I came to know that the total number of 'sheep' (including the wolves) now present in my kingdom is 100. Among which 5 are wolves. Our doctors have come up with a very expensive blood test which could be used to differentiate the wolves and sheep.
Each test costs 1000$ and we don't have enough funds to test all the 100 'sheep'.
I discussed with our ministers and came to know that the tests can be done on pooled bloodsamples. i.e., I can collect bloods from any number of 'sheep' and mix them. Then if I test the mixture, I will get a positive result if the mixture contain blood from any wolf. I will get a negative result if all the samples are from actual sheep.
One caveat is that the test results are available to you after all the tests are done!
Now , I am looking for ideas where I can find ALL the wolves in minimum number of pooled tests. I request the brilliant young minds of this land to come up with a testing strategy.
Can you help the king by devising a strategy?
Hint 1:
Think of total number of ways 5 wolves can infiltrate 95 sheep.
Hint 2:
Think of binary sequences to distinguish each of the possible groups of 5 wolves
strategy combinatorics algorithm
strategy combinatorics algorithm
edited yesterday
Jyotish Robin
asked 2 days ago
Jyotish RobinJyotish Robin
567113
567113
1
$begingroup$
This is close to a covering design (Lotto wheel) problem.
$endgroup$
– Arnaud Mortier
2 days ago
3
$begingroup$
First of all, does the government have enough funds to test 99 of the sheep? Because that would work, at a cost of $99,000. Congrats, you just saved 1,000 bucks.
$endgroup$
– user45266
yesterday
3
$begingroup$
Alternatively, you know the location of all 5 wolves. Take initiative and slaughter all 100. Now you have no more wolves, and food for a good while to come.
$endgroup$
– user45266
yesterday
add a comment |
1
$begingroup$
This is close to a covering design (Lotto wheel) problem.
$endgroup$
– Arnaud Mortier
2 days ago
3
$begingroup$
First of all, does the government have enough funds to test 99 of the sheep? Because that would work, at a cost of $99,000. Congrats, you just saved 1,000 bucks.
$endgroup$
– user45266
yesterday
3
$begingroup$
Alternatively, you know the location of all 5 wolves. Take initiative and slaughter all 100. Now you have no more wolves, and food for a good while to come.
$endgroup$
– user45266
yesterday
1
1
$begingroup$
This is close to a covering design (Lotto wheel) problem.
$endgroup$
– Arnaud Mortier
2 days ago
$begingroup$
This is close to a covering design (Lotto wheel) problem.
$endgroup$
– Arnaud Mortier
2 days ago
3
3
$begingroup$
First of all, does the government have enough funds to test 99 of the sheep? Because that would work, at a cost of $99,000. Congrats, you just saved 1,000 bucks.
$endgroup$
– user45266
yesterday
$begingroup$
First of all, does the government have enough funds to test 99 of the sheep? Because that would work, at a cost of $99,000. Congrats, you just saved 1,000 bucks.
$endgroup$
– user45266
yesterday
3
3
$begingroup$
Alternatively, you know the location of all 5 wolves. Take initiative and slaughter all 100. Now you have no more wolves, and food for a good while to come.
$endgroup$
– user45266
yesterday
$begingroup$
Alternatively, you know the location of all 5 wolves. Take initiative and slaughter all 100. Now you have no more wolves, and food for a good while to come.
$endgroup$
– user45266
yesterday
add a comment |
5 Answers
5
active
oldest
votes
$begingroup$
I'm not sure whether this should be an edit to my original attempt, or a new answer because it is a very different approach. What's the standard practice?
I think it can be done in 35 tests:
Split the population in half, in 7 different ways:
- every alternate sheep
- two sheep then skip two
- four sheep then skip four
- eight sheep then skip eight
- ...
- 64 sheep then skip 64
This gives groups like the following (where 1 means the sheep is selected, 0 means it is not selected):
A 01010101010101010101010101010101
B 00110011001100110011001100110011
C 00001111000011110000111100001111
D 00000000111111110000000011111111
E 00000000000000001111111111111111
Test each group. Shift all the sheep to the right, carry the last sheep around to the front, and repeat the same steps 4 times. This results in 7 * 5 = 35 tests being performed.
A simple example (partly because I'm lazy, and partly because it wraps around too much) of 32 sheep with 3 wolves among them, which requires only 5 tests and 3 iterations:
Iteration 1 = 11000000000000000000000000000001
Iteration 2 = 11100000000000000000000000000000
Iteration 3 = 01110000000000000000000000000000
Where 1 represents a wolf and 0 a sheep, then the test results for each iteration are:
| Iteration 1 | Iteration 2 | Iteration 3
A | Positive | Positive | Positive
B | Positive | Positive | Positive
C | Positive | Negative | Negative
D | Positive | Negative | Negative
E | Positive | Negative | Negative
Using these test results, we can narrow down the suspects:
Iteration 1 suspects = All sheep
Iteration 2 suspects = All sheep & !C & !D & !E
Iteration 3 suspects = All sheep & !C & !D & !E
Iteration 1 suspects = 11111111111111111111111111111111
Iteration 2 suspects = 11110000000000000000000000000000
Iteration 3 suspects = 11110000000000000000000000000000
Now when we bring the front sheep of each iteration back to the end to re-align them:
Iteration 1 suspects = 11111111111111111111111111111111
Iteration 2 suspects = 11100000000000000000000000000001
Iteration 3 suspects = 11000000000000000000000000000011
Wolves = I1 suspects & I2 suspects & I3 suspects
Wolves = 11000000000000000000000000000001
This still feels wildly inefficient. I'd love to see the OP's answer.
New contributor
Andrew Williamson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
$begingroup$
This matches what I was thinking. In one "iteration" oflg Ntests, you can find a lone wolf. If you can make 2 independent sheep-to-number mappings, then you can find 2 wolves in 2 iterations oflg Ntests. And so on. I couldn't figure out how to construct those mappings, but you show that it's super simple. :) So your method can find K wolves inK lg Ntests. Your answer of 35 is not terribly far off the mathematically theoretical minimum ofceil(lg (100 choose 5)) =27 tests.
$endgroup$
– Quuxplusone
yesterday
1
$begingroup$
Why do you think this works? Do wolves in positions 2, 60, and 69 make all tests pass?
$endgroup$
– noedne
yesterday
$begingroup$
Another hint as @Quuxplusone pointed out . 2^27~ 100C5. Consider assigning binary sequence of 0 & 1 for all sets of 5.
$endgroup$
– Jyotish Robin
yesterday
$begingroup$
@JyotishRobin: Aha, that's almost a complete solution posted as a hint, isn't it?
$endgroup$
– Quuxplusone
yesterday
2
$begingroup$
This solution as presented can give ambiguous results. For example, using your 32 sheep example, if you have wolves in positions 30, 31, 32 - all tests for all iterations will be positive. You might say, well, that just means I can conclude that the wolves are at those positions. However, if the wolves are at positions 29, 31, 32 all tests will also be positive for all iterations. Now you don't know if a wolf is at 29 or 30, so this solution fails.
$endgroup$
– Amorydai
yesterday
|
show 2 more comments
$begingroup$
I think this can be done in 39 tests.
Arrange the sheep in a 10x10 grid. Collect a sample from each row, column, and
the diagonals in one direction. Once the results come back, draw a line across
the grid for each positive test result. When three lines intersect, that's a
wolf!
As a quick example, after arranging 25 sheep into a grid, we have the following:
S S W S S
S W S S S
S S S S S
S S S S W
S S S S S
This gives us positive test results for rows 1, 2, 4, columns 2, 3, 5, and diagonals (/starting from the top left) 3, 8.
- 2 3 - 2
- 3 2 - 2
/ | | |
- 2 2 - 3
| | / |
This shows the wolves where there are 3 overlaps. It also shows the need for the diagonals - there are overlaps of 2 lines, which are just sheep that happen to line up with wolves. Without the diagonals, we wouldn't be able to tell the difference.
Unfortunately, as has been pointed out in the comments, there are some edge cases where this solution does not narrow down the results to only 5 wolves.
W S S
W S S
W W W
This results in a false positive on all of the sheep.
Edit
I've been thinking more about the maths behind this, and would like to try to refine it. The base line is testing all 100 sheep, which guarantees 5/100 positives and the rest negative.
In my answer above, I divide the sheep into groups of 10, which guarantees 5/10 positives and 5/10 negatives. By doing this, I've halved the number of sheep to search with only 10 samples.
As you can see with the grid example, by splitting the sheep in a different way, i.e. rows instead of columns, I can perform the search again and narrow down to 25 sheep with only 20 tests.
I don't exactly know how to explain what makes the distribution special, but when the sheep are arranged in a grid, I can use the following function to redistribute the sheep into new groups for each test:group(x, y, test) = (x + (y * test)) % 10
(With each iteration, shuffle each row across to the left according to its row number, e.g row 0 stays where it is, row 1 gets shuffled 1 to the left, row 2 gets shuffled 2 to the left).
With this distribution function, we can keep adding iterations to narrow down the suspected sheep, until the number is less than or equal to 5:suspects = 100 * ((5 / 10) ^ iterations)
In order to be certain, we need to repeat this 5 times, which is 50 tests.
I think this might work for other group sizes as well:suspects = 100 * ((5 / groups) ^ iterations)
Groups | Iterations | Samples
-------|------------|---------
7 | 9 | 63
8 | 7 | 56
9 | 6 | 54
10 | 5 | 50
11 | 4 | 44
12 | 4 | 48
13 | 4 | 52
14 | 3 | 42
15 | 3 | 45
16 | 3 | 48
17 | 3 | 51
18 | 3 | 54
19 | 3 | 57
20 | 3 | 60
21 | 3 | 63
22 | 3 | 66
23 | 2 | 46
So using this method, with a group size of 14 and 3 iterations, it looks like it might be possible with 42 tests to determine the wolves. However, I haven't managed to prove this, I think I've spent enough time on this puzzle. I also wondered whether it is possible to arrange the sheep in a cube instead of a grid, but I never managed to work it out.
New contributor
Andrew Williamson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
$begingroup$
+1! Are the diagonals required?
$endgroup$
– user45266
yesterday
$begingroup$
Could you elaborate on how the number 39 is obtained. Also more details on how the testing is done can help the reader understand it better.
$endgroup$
– Jyotish Robin
yesterday
$begingroup$
Oops, that's a spoiler, probably should learn that rot13 thing I see everywhere on this site
$endgroup$
– Andrew Williamson
yesterday
$begingroup$
It would be better if you could add the additional info to the answer itself instead of the comment.
$endgroup$
– Jyotish Robin
yesterday
1
$begingroup$
Love this solution, but I'm not sure that it's correct. rot13: Vs gurer ner jbyirf ng (1,5), (2,3), (3,2), naq (4,4), gura (1,4) jvyy fubj hc nf n jbys ab znggre jung, fvapr ur'f va gur fnzr ebj, pbyhza, naq qvntbany nf n jbys.
$endgroup$
– cag51
yesterday
|
show 6 more comments
$begingroup$
Thinking out loud, not a solution yet, but spoilery enough that I didn't want to put it in a comment:
There are $100choose 5 > 2^26$ possible arrangements of the 5 wolves among 100 sheep. This indicates that we must use at least 27 tests, no matter what — that's just basic information theory.
Could we design a strategy to use the bare minimum? Well, if there were just one wolf, then yes we could. There are $100choose 1 > 2^6$ possible arrangements of a single wolf among 100 sheep. Assign each arrangement a number; express each number in binary (using 7 bits); then perform 7 tests to determine which arrangement is the right one. This is The blood test riddle (number theory) by another name.
However,
if there are two wolves, then I have seen proof that we cannot always do it in the bare information-theoretical minimum number of tests. Suppose we have 6 sheep, two of whom are wolves. There are $6choose 2 = 15 leq 2^4$ possible arrangements of two wolves among 6 sheep. But I wrote a little Python script to do a brute-force exhaustive search, and it concluded that there is no way to unambiguously identify the two wolves out of six sheep, using only four blood tests.
This is evidence that the solution to this puzzle probably (but not definitely) requires more than 27 tests.
Still-not-an-answer UPDATE:
According to my new and improved brute-force script,
There is no way to find 2,3,4,5 wolves among 6 sheep in fewer than 5 tests.
There is no way to find 2,3,4,5,6 wolves among 7 sheep in fewer than 6 tests.
There is no way to find 3,4,5,6,7 wolves among 8 sheep in fewer than 7 tests.
There is no way to find 3,4,5,6,7 wolves among 9 sheep in fewer than 8 tests.
However,
to find 2 wolves among 8 sheep, we don't need 7 tests — we can do it in 6 tests!
Test 1. T . . T T . . .
Test 2. T . . . . T T .
Test 3. . T . T . T . .
Test 4. . T . . T . T .
Test 5. . . T . T T . .
Test 6. . . T T . . T .
Notice the nice symmetry of the first three columns (sheep), and then what we do with the next four columns in each pair of rows (tests). The eighth sheep doesn't need to be tested at all; we can figure him out by deductive reasoning.
So this is evidence that perhaps the original puzzle can be done in fewer than 99 tests!
I also notice that the situation is not symmetrical: we may know a way to find $k$ wolves among $n$ sheep using $t$ tests, but that won't help us at all to find $n-k$ wolves among $n$ sheep. (Under the spoiler tags above, I show one concrete example where $n,k,t$ is possible yet $n,n-k,t$ is not possible.)
$endgroup$
$begingroup$
Your calculations confirm my suspicions. I was trying to figure out a process to arrive at the heavy-handed hint of 100C5 and 2^27 by assigning each permutation to a single binary number, but that fails miserably. The only saving grace was that 2^27 is almost twice as large as 100C5, so not all binary numbers have to be represented. Alas, I still cannot find a way.
$endgroup$
– Amorydai
1 hour ago
add a comment |
$begingroup$
Here's my shot at it:
Pool 50 of the sheep. Of those 50, if the result comes back positive (wolf detected), split in half again, testing 25 pooled together. If this comes back positive, either 12 or 13 ofthe positive group. You see where this is going. Any negative results rule out all sheep in that group. Worst case scenario, it takes 54 tests (see image for explanation). Best case scenario, you get 14 tests. Price range: 14,000 - 54,000 dollars.
Not sure yet of the expected average, but I know this is better than 99 tests on average.
Diagram:
If this isn't the optimal solution, then my best bet on how to improve it would be to:
split into 1/5 the size of each group.
EDIT: Apparently, you can only do all your tests in one step. So that means you need 99 tests (the last one is obvious, it's either the 95th sheep or the 5th wolf), unless I'm missing something. Cost: $99,000.
$endgroup$
1
$begingroup$
You forgot that the test results are available to you only after all the tests are done!
$endgroup$
– Jyotish Robin
yesterday
$begingroup$
Oh, shoot. But how would that even work?! I can't really see any way to deduce the identities of all wolves in one step without 99 separate tests! I hope you know the answer to this, because I really want to know now!
$endgroup$
– user45266
yesterday
$begingroup$
You can do multiple tests. But the catch is that you will only see the results at the end of all tests. I will wait for you or other bright heads to spend more time before I consider posting the answer :)
$endgroup$
– Jyotish Robin
yesterday
add a comment |
$begingroup$
I can do it in about 28 tests.
As Quuxplusone pointed out, for 5 wolves hiding among 100 sheep, there are $100 choose 5 approx 2^26.2$ scenarios. Thus you need at least 27 tests.
$ $
To solve this, we essentially perform 5 binary searches, each to find the first remaining unidentified wolf. But we don't want to simply split the group in half; there is about a 97% chance that the first wolf is in the first 50. The key is to recognize that the goal of each step in a binary search is not to cut the group in half, but to cut the number of scenarios in half.
$ $
If we test $n$ animals out of 100, of which 5 are wolves, then the probability of getting a "no" is $P(n;5,100) = 100-n choose 5 over 100 choose 5$. The goal is to select $n$ so that ratio is as close to 50% as possible. Also, if $n$ is not too large, then if the answer is yes, the odds are good that there is only one wolf in the test group, so a standard binary search is the best way to identify the wolf within the group. For efficiency, $n$ should always be a power of 2.
$ $
For 100 sheep, the first $n$ should thus be 16. A "no" answer would reduce the number of possibilities from 75 million to 30 million. While 13 would give a more exact split (37 million), a binary search on 13 animals takes as many tests as a binary search on 16, so we might as well test 16.
$ $
If the answer is no, we would test the next 16, where a "no" would reduce the number of possibilities to 10 million. As long as we kept getting "no", we could continue testing at 8, 8, 8, 8, 4, 4, 4, 4, 2, 2, 2, 2. After that we would be down to 12 animals and there would be no point in testing more than one at a time. Thus, if all 5 wolves are among the last twelve, that would lead to 21 to 25 tests.
$ $
Far more likely is the chance that some of the tests would yield "yes". There's an 87% chance that one of the first two tests would yield "yes". That would identify the first wolf as one of a group of 16. A standard binary search (first 8, then first 4 of one half, etc.) takes 4 more tests to identify the first wolf.
$ $
A side-effect of this approach is that once the first wolf is identified, all earlier animals are known to be sheep (because they were each part of a group that tested no). Worst case scenario is where the first animal is a wolf, in which case we took 5 tests to determine that, but learned nothing else.
$ $
Once we have determined the first wolf, we continue with the remaining wolves. Worst case is we have 99 more animals, of which 4 are wolves. In this case, testing 16 animals would cut the remaining scenarios roughly in half. Etc.
$ $
If the first three wolves are the first three animals, it would take 15 tests to identify them and learn nothing else. We then have 97 more animals, of which 2 are wolves (a total of 4656 combinations). We would want to test more than 16 animals to split the scenarios effectively. Testing 32 would split the scnearios to 2080 for no, or 2576 for yes.
$ $
The goal is that each "no" should reduce the set of remaining scenarios to less than half the previous. Each "yes" would then be followed by a binary search of several tests which each cut the number of scenarios almost exactly in half. Thus, we should be able to remain very close to the ideal number of tests.
$ $
A possible worst case, where we learn the minimum amount from each test, is when the wolves are the first 5 animals, yielding "yes" answers every time. That would take 5 tests to identify the first wolf, 5 more to identify the second, 5 to identify the third, 6 to identify the fourth, and 7 to identify the last, for a total of 28 tests.
It is possible that there is a scenario that requires more than 28 tests, but we would have to go through thousands of scenarios to check each to see which is worst. In any case, it should not be worse by more than one or two additional tests.
$endgroup$
1
$begingroup$
Oh, if you need to do all the tests at once, this obviously won't work. Nevermind then.
$endgroup$
– user3294068
5 hours ago
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "559"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fpuzzling.stackexchange.com%2fquestions%2f81737%2fwolves-and-sheep%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
I'm not sure whether this should be an edit to my original attempt, or a new answer because it is a very different approach. What's the standard practice?
I think it can be done in 35 tests:
Split the population in half, in 7 different ways:
- every alternate sheep
- two sheep then skip two
- four sheep then skip four
- eight sheep then skip eight
- ...
- 64 sheep then skip 64
This gives groups like the following (where 1 means the sheep is selected, 0 means it is not selected):
A 01010101010101010101010101010101
B 00110011001100110011001100110011
C 00001111000011110000111100001111
D 00000000111111110000000011111111
E 00000000000000001111111111111111
Test each group. Shift all the sheep to the right, carry the last sheep around to the front, and repeat the same steps 4 times. This results in 7 * 5 = 35 tests being performed.
A simple example (partly because I'm lazy, and partly because it wraps around too much) of 32 sheep with 3 wolves among them, which requires only 5 tests and 3 iterations:
Iteration 1 = 11000000000000000000000000000001
Iteration 2 = 11100000000000000000000000000000
Iteration 3 = 01110000000000000000000000000000
Where 1 represents a wolf and 0 a sheep, then the test results for each iteration are:
| Iteration 1 | Iteration 2 | Iteration 3
A | Positive | Positive | Positive
B | Positive | Positive | Positive
C | Positive | Negative | Negative
D | Positive | Negative | Negative
E | Positive | Negative | Negative
Using these test results, we can narrow down the suspects:
Iteration 1 suspects = All sheep
Iteration 2 suspects = All sheep & !C & !D & !E
Iteration 3 suspects = All sheep & !C & !D & !E
Iteration 1 suspects = 11111111111111111111111111111111
Iteration 2 suspects = 11110000000000000000000000000000
Iteration 3 suspects = 11110000000000000000000000000000
Now when we bring the front sheep of each iteration back to the end to re-align them:
Iteration 1 suspects = 11111111111111111111111111111111
Iteration 2 suspects = 11100000000000000000000000000001
Iteration 3 suspects = 11000000000000000000000000000011
Wolves = I1 suspects & I2 suspects & I3 suspects
Wolves = 11000000000000000000000000000001
This still feels wildly inefficient. I'd love to see the OP's answer.
New contributor
Andrew Williamson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
$begingroup$
This matches what I was thinking. In one "iteration" oflg Ntests, you can find a lone wolf. If you can make 2 independent sheep-to-number mappings, then you can find 2 wolves in 2 iterations oflg Ntests. And so on. I couldn't figure out how to construct those mappings, but you show that it's super simple. :) So your method can find K wolves inK lg Ntests. Your answer of 35 is not terribly far off the mathematically theoretical minimum ofceil(lg (100 choose 5)) =27 tests.
$endgroup$
– Quuxplusone
yesterday
1
$begingroup$
Why do you think this works? Do wolves in positions 2, 60, and 69 make all tests pass?
$endgroup$
– noedne
yesterday
$begingroup$
Another hint as @Quuxplusone pointed out . 2^27~ 100C5. Consider assigning binary sequence of 0 & 1 for all sets of 5.
$endgroup$
– Jyotish Robin
yesterday
$begingroup$
@JyotishRobin: Aha, that's almost a complete solution posted as a hint, isn't it?
$endgroup$
– Quuxplusone
yesterday
2
$begingroup$
This solution as presented can give ambiguous results. For example, using your 32 sheep example, if you have wolves in positions 30, 31, 32 - all tests for all iterations will be positive. You might say, well, that just means I can conclude that the wolves are at those positions. However, if the wolves are at positions 29, 31, 32 all tests will also be positive for all iterations. Now you don't know if a wolf is at 29 or 30, so this solution fails.
$endgroup$
– Amorydai
yesterday
|
show 2 more comments
$begingroup$
I'm not sure whether this should be an edit to my original attempt, or a new answer because it is a very different approach. What's the standard practice?
I think it can be done in 35 tests:
Split the population in half, in 7 different ways:
- every alternate sheep
- two sheep then skip two
- four sheep then skip four
- eight sheep then skip eight
- ...
- 64 sheep then skip 64
This gives groups like the following (where 1 means the sheep is selected, 0 means it is not selected):
A 01010101010101010101010101010101
B 00110011001100110011001100110011
C 00001111000011110000111100001111
D 00000000111111110000000011111111
E 00000000000000001111111111111111
Test each group. Shift all the sheep to the right, carry the last sheep around to the front, and repeat the same steps 4 times. This results in 7 * 5 = 35 tests being performed.
A simple example (partly because I'm lazy, and partly because it wraps around too much) of 32 sheep with 3 wolves among them, which requires only 5 tests and 3 iterations:
Iteration 1 = 11000000000000000000000000000001
Iteration 2 = 11100000000000000000000000000000
Iteration 3 = 01110000000000000000000000000000
Where 1 represents a wolf and 0 a sheep, then the test results for each iteration are:
| Iteration 1 | Iteration 2 | Iteration 3
A | Positive | Positive | Positive
B | Positive | Positive | Positive
C | Positive | Negative | Negative
D | Positive | Negative | Negative
E | Positive | Negative | Negative
Using these test results, we can narrow down the suspects:
Iteration 1 suspects = All sheep
Iteration 2 suspects = All sheep & !C & !D & !E
Iteration 3 suspects = All sheep & !C & !D & !E
Iteration 1 suspects = 11111111111111111111111111111111
Iteration 2 suspects = 11110000000000000000000000000000
Iteration 3 suspects = 11110000000000000000000000000000
Now when we bring the front sheep of each iteration back to the end to re-align them:
Iteration 1 suspects = 11111111111111111111111111111111
Iteration 2 suspects = 11100000000000000000000000000001
Iteration 3 suspects = 11000000000000000000000000000011
Wolves = I1 suspects & I2 suspects & I3 suspects
Wolves = 11000000000000000000000000000001
This still feels wildly inefficient. I'd love to see the OP's answer.
New contributor
Andrew Williamson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
$begingroup$
This matches what I was thinking. In one "iteration" oflg Ntests, you can find a lone wolf. If you can make 2 independent sheep-to-number mappings, then you can find 2 wolves in 2 iterations oflg Ntests. And so on. I couldn't figure out how to construct those mappings, but you show that it's super simple. :) So your method can find K wolves inK lg Ntests. Your answer of 35 is not terribly far off the mathematically theoretical minimum ofceil(lg (100 choose 5)) =27 tests.
$endgroup$
– Quuxplusone
yesterday
1
$begingroup$
Why do you think this works? Do wolves in positions 2, 60, and 69 make all tests pass?
$endgroup$
– noedne
yesterday
$begingroup$
Another hint as @Quuxplusone pointed out . 2^27~ 100C5. Consider assigning binary sequence of 0 & 1 for all sets of 5.
$endgroup$
– Jyotish Robin
yesterday
$begingroup$
@JyotishRobin: Aha, that's almost a complete solution posted as a hint, isn't it?
$endgroup$
– Quuxplusone
yesterday
2
$begingroup$
This solution as presented can give ambiguous results. For example, using your 32 sheep example, if you have wolves in positions 30, 31, 32 - all tests for all iterations will be positive. You might say, well, that just means I can conclude that the wolves are at those positions. However, if the wolves are at positions 29, 31, 32 all tests will also be positive for all iterations. Now you don't know if a wolf is at 29 or 30, so this solution fails.
$endgroup$
– Amorydai
yesterday
|
show 2 more comments
$begingroup$
I'm not sure whether this should be an edit to my original attempt, or a new answer because it is a very different approach. What's the standard practice?
I think it can be done in 35 tests:
Split the population in half, in 7 different ways:
- every alternate sheep
- two sheep then skip two
- four sheep then skip four
- eight sheep then skip eight
- ...
- 64 sheep then skip 64
This gives groups like the following (where 1 means the sheep is selected, 0 means it is not selected):
A 01010101010101010101010101010101
B 00110011001100110011001100110011
C 00001111000011110000111100001111
D 00000000111111110000000011111111
E 00000000000000001111111111111111
Test each group. Shift all the sheep to the right, carry the last sheep around to the front, and repeat the same steps 4 times. This results in 7 * 5 = 35 tests being performed.
A simple example (partly because I'm lazy, and partly because it wraps around too much) of 32 sheep with 3 wolves among them, which requires only 5 tests and 3 iterations:
Iteration 1 = 11000000000000000000000000000001
Iteration 2 = 11100000000000000000000000000000
Iteration 3 = 01110000000000000000000000000000
Where 1 represents a wolf and 0 a sheep, then the test results for each iteration are:
| Iteration 1 | Iteration 2 | Iteration 3
A | Positive | Positive | Positive
B | Positive | Positive | Positive
C | Positive | Negative | Negative
D | Positive | Negative | Negative
E | Positive | Negative | Negative
Using these test results, we can narrow down the suspects:
Iteration 1 suspects = All sheep
Iteration 2 suspects = All sheep & !C & !D & !E
Iteration 3 suspects = All sheep & !C & !D & !E
Iteration 1 suspects = 11111111111111111111111111111111
Iteration 2 suspects = 11110000000000000000000000000000
Iteration 3 suspects = 11110000000000000000000000000000
Now when we bring the front sheep of each iteration back to the end to re-align them:
Iteration 1 suspects = 11111111111111111111111111111111
Iteration 2 suspects = 11100000000000000000000000000001
Iteration 3 suspects = 11000000000000000000000000000011
Wolves = I1 suspects & I2 suspects & I3 suspects
Wolves = 11000000000000000000000000000001
This still feels wildly inefficient. I'd love to see the OP's answer.
New contributor
Andrew Williamson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
I'm not sure whether this should be an edit to my original attempt, or a new answer because it is a very different approach. What's the standard practice?
I think it can be done in 35 tests:
Split the population in half, in 7 different ways:
- every alternate sheep
- two sheep then skip two
- four sheep then skip four
- eight sheep then skip eight
- ...
- 64 sheep then skip 64
This gives groups like the following (where 1 means the sheep is selected, 0 means it is not selected):
A 01010101010101010101010101010101
B 00110011001100110011001100110011
C 00001111000011110000111100001111
D 00000000111111110000000011111111
E 00000000000000001111111111111111
Test each group. Shift all the sheep to the right, carry the last sheep around to the front, and repeat the same steps 4 times. This results in 7 * 5 = 35 tests being performed.
A simple example (partly because I'm lazy, and partly because it wraps around too much) of 32 sheep with 3 wolves among them, which requires only 5 tests and 3 iterations:
Iteration 1 = 11000000000000000000000000000001
Iteration 2 = 11100000000000000000000000000000
Iteration 3 = 01110000000000000000000000000000
Where 1 represents a wolf and 0 a sheep, then the test results for each iteration are:
| Iteration 1 | Iteration 2 | Iteration 3
A | Positive | Positive | Positive
B | Positive | Positive | Positive
C | Positive | Negative | Negative
D | Positive | Negative | Negative
E | Positive | Negative | Negative
Using these test results, we can narrow down the suspects:
Iteration 1 suspects = All sheep
Iteration 2 suspects = All sheep & !C & !D & !E
Iteration 3 suspects = All sheep & !C & !D & !E
Iteration 1 suspects = 11111111111111111111111111111111
Iteration 2 suspects = 11110000000000000000000000000000
Iteration 3 suspects = 11110000000000000000000000000000
Now when we bring the front sheep of each iteration back to the end to re-align them:
Iteration 1 suspects = 11111111111111111111111111111111
Iteration 2 suspects = 11100000000000000000000000000001
Iteration 3 suspects = 11000000000000000000000000000011
Wolves = I1 suspects & I2 suspects & I3 suspects
Wolves = 11000000000000000000000000000001
This still feels wildly inefficient. I'd love to see the OP's answer.
New contributor
Andrew Williamson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Andrew Williamson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered yesterday
Andrew WilliamsonAndrew Williamson
1693
1693
New contributor
Andrew Williamson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Andrew Williamson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Andrew Williamson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$begingroup$
This matches what I was thinking. In one "iteration" oflg Ntests, you can find a lone wolf. If you can make 2 independent sheep-to-number mappings, then you can find 2 wolves in 2 iterations oflg Ntests. And so on. I couldn't figure out how to construct those mappings, but you show that it's super simple. :) So your method can find K wolves inK lg Ntests. Your answer of 35 is not terribly far off the mathematically theoretical minimum ofceil(lg (100 choose 5)) =27 tests.
$endgroup$
– Quuxplusone
yesterday
1
$begingroup$
Why do you think this works? Do wolves in positions 2, 60, and 69 make all tests pass?
$endgroup$
– noedne
yesterday
$begingroup$
Another hint as @Quuxplusone pointed out . 2^27~ 100C5. Consider assigning binary sequence of 0 & 1 for all sets of 5.
$endgroup$
– Jyotish Robin
yesterday
$begingroup$
@JyotishRobin: Aha, that's almost a complete solution posted as a hint, isn't it?
$endgroup$
– Quuxplusone
yesterday
2
$begingroup$
This solution as presented can give ambiguous results. For example, using your 32 sheep example, if you have wolves in positions 30, 31, 32 - all tests for all iterations will be positive. You might say, well, that just means I can conclude that the wolves are at those positions. However, if the wolves are at positions 29, 31, 32 all tests will also be positive for all iterations. Now you don't know if a wolf is at 29 or 30, so this solution fails.
$endgroup$
– Amorydai
yesterday
|
show 2 more comments
$begingroup$
This matches what I was thinking. In one "iteration" oflg Ntests, you can find a lone wolf. If you can make 2 independent sheep-to-number mappings, then you can find 2 wolves in 2 iterations oflg Ntests. And so on. I couldn't figure out how to construct those mappings, but you show that it's super simple. :) So your method can find K wolves inK lg Ntests. Your answer of 35 is not terribly far off the mathematically theoretical minimum ofceil(lg (100 choose 5)) =27 tests.
$endgroup$
– Quuxplusone
yesterday
1
$begingroup$
Why do you think this works? Do wolves in positions 2, 60, and 69 make all tests pass?
$endgroup$
– noedne
yesterday
$begingroup$
Another hint as @Quuxplusone pointed out . 2^27~ 100C5. Consider assigning binary sequence of 0 & 1 for all sets of 5.
$endgroup$
– Jyotish Robin
yesterday
$begingroup$
@JyotishRobin: Aha, that's almost a complete solution posted as a hint, isn't it?
$endgroup$
– Quuxplusone
yesterday
2
$begingroup$
This solution as presented can give ambiguous results. For example, using your 32 sheep example, if you have wolves in positions 30, 31, 32 - all tests for all iterations will be positive. You might say, well, that just means I can conclude that the wolves are at those positions. However, if the wolves are at positions 29, 31, 32 all tests will also be positive for all iterations. Now you don't know if a wolf is at 29 or 30, so this solution fails.
$endgroup$
– Amorydai
yesterday
$begingroup$
This matches what I was thinking. In one "iteration" of
lg N tests, you can find a lone wolf. If you can make 2 independent sheep-to-number mappings, then you can find 2 wolves in 2 iterations of lg N tests. And so on. I couldn't figure out how to construct those mappings, but you show that it's super simple. :) So your method can find K wolves in K lg N tests. Your answer of 35 is not terribly far off the mathematically theoretical minimum of ceil(lg (100 choose 5)) = 27 tests.$endgroup$
– Quuxplusone
yesterday
$begingroup$
This matches what I was thinking. In one "iteration" of
lg N tests, you can find a lone wolf. If you can make 2 independent sheep-to-number mappings, then you can find 2 wolves in 2 iterations of lg N tests. And so on. I couldn't figure out how to construct those mappings, but you show that it's super simple. :) So your method can find K wolves in K lg N tests. Your answer of 35 is not terribly far off the mathematically theoretical minimum of ceil(lg (100 choose 5)) = 27 tests.$endgroup$
– Quuxplusone
yesterday
1
1
$begingroup$
Why do you think this works? Do wolves in positions 2, 60, and 69 make all tests pass?
$endgroup$
– noedne
yesterday
$begingroup$
Why do you think this works? Do wolves in positions 2, 60, and 69 make all tests pass?
$endgroup$
– noedne
yesterday
$begingroup$
Another hint as @Quuxplusone pointed out . 2^27~ 100C5. Consider assigning binary sequence of 0 & 1 for all sets of 5.
$endgroup$
– Jyotish Robin
yesterday
$begingroup$
Another hint as @Quuxplusone pointed out . 2^27~ 100C5. Consider assigning binary sequence of 0 & 1 for all sets of 5.
$endgroup$
– Jyotish Robin
yesterday
$begingroup$
@JyotishRobin: Aha, that's almost a complete solution posted as a hint, isn't it?
$endgroup$
– Quuxplusone
yesterday
$begingroup$
@JyotishRobin: Aha, that's almost a complete solution posted as a hint, isn't it?
$endgroup$
– Quuxplusone
yesterday
2
2
$begingroup$
This solution as presented can give ambiguous results. For example, using your 32 sheep example, if you have wolves in positions 30, 31, 32 - all tests for all iterations will be positive. You might say, well, that just means I can conclude that the wolves are at those positions. However, if the wolves are at positions 29, 31, 32 all tests will also be positive for all iterations. Now you don't know if a wolf is at 29 or 30, so this solution fails.
$endgroup$
– Amorydai
yesterday
$begingroup$
This solution as presented can give ambiguous results. For example, using your 32 sheep example, if you have wolves in positions 30, 31, 32 - all tests for all iterations will be positive. You might say, well, that just means I can conclude that the wolves are at those positions. However, if the wolves are at positions 29, 31, 32 all tests will also be positive for all iterations. Now you don't know if a wolf is at 29 or 30, so this solution fails.
$endgroup$
– Amorydai
yesterday
|
show 2 more comments
$begingroup$
I think this can be done in 39 tests.
Arrange the sheep in a 10x10 grid. Collect a sample from each row, column, and
the diagonals in one direction. Once the results come back, draw a line across
the grid for each positive test result. When three lines intersect, that's a
wolf!
As a quick example, after arranging 25 sheep into a grid, we have the following:
S S W S S
S W S S S
S S S S S
S S S S W
S S S S S
This gives us positive test results for rows 1, 2, 4, columns 2, 3, 5, and diagonals (/starting from the top left) 3, 8.
- 2 3 - 2
- 3 2 - 2
/ | | |
- 2 2 - 3
| | / |
This shows the wolves where there are 3 overlaps. It also shows the need for the diagonals - there are overlaps of 2 lines, which are just sheep that happen to line up with wolves. Without the diagonals, we wouldn't be able to tell the difference.
Unfortunately, as has been pointed out in the comments, there are some edge cases where this solution does not narrow down the results to only 5 wolves.
W S S
W S S
W W W
This results in a false positive on all of the sheep.
Edit
I've been thinking more about the maths behind this, and would like to try to refine it. The base line is testing all 100 sheep, which guarantees 5/100 positives and the rest negative.
In my answer above, I divide the sheep into groups of 10, which guarantees 5/10 positives and 5/10 negatives. By doing this, I've halved the number of sheep to search with only 10 samples.
As you can see with the grid example, by splitting the sheep in a different way, i.e. rows instead of columns, I can perform the search again and narrow down to 25 sheep with only 20 tests.
I don't exactly know how to explain what makes the distribution special, but when the sheep are arranged in a grid, I can use the following function to redistribute the sheep into new groups for each test:group(x, y, test) = (x + (y * test)) % 10
(With each iteration, shuffle each row across to the left according to its row number, e.g row 0 stays where it is, row 1 gets shuffled 1 to the left, row 2 gets shuffled 2 to the left).
With this distribution function, we can keep adding iterations to narrow down the suspected sheep, until the number is less than or equal to 5:suspects = 100 * ((5 / 10) ^ iterations)
In order to be certain, we need to repeat this 5 times, which is 50 tests.
I think this might work for other group sizes as well:suspects = 100 * ((5 / groups) ^ iterations)
Groups | Iterations | Samples
-------|------------|---------
7 | 9 | 63
8 | 7 | 56
9 | 6 | 54
10 | 5 | 50
11 | 4 | 44
12 | 4 | 48
13 | 4 | 52
14 | 3 | 42
15 | 3 | 45
16 | 3 | 48
17 | 3 | 51
18 | 3 | 54
19 | 3 | 57
20 | 3 | 60
21 | 3 | 63
22 | 3 | 66
23 | 2 | 46
So using this method, with a group size of 14 and 3 iterations, it looks like it might be possible with 42 tests to determine the wolves. However, I haven't managed to prove this, I think I've spent enough time on this puzzle. I also wondered whether it is possible to arrange the sheep in a cube instead of a grid, but I never managed to work it out.
New contributor
Andrew Williamson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
$begingroup$
+1! Are the diagonals required?
$endgroup$
– user45266
yesterday
$begingroup$
Could you elaborate on how the number 39 is obtained. Also more details on how the testing is done can help the reader understand it better.
$endgroup$
– Jyotish Robin
yesterday
$begingroup$
Oops, that's a spoiler, probably should learn that rot13 thing I see everywhere on this site
$endgroup$
– Andrew Williamson
yesterday
$begingroup$
It would be better if you could add the additional info to the answer itself instead of the comment.
$endgroup$
– Jyotish Robin
yesterday
1
$begingroup$
Love this solution, but I'm not sure that it's correct. rot13: Vs gurer ner jbyirf ng (1,5), (2,3), (3,2), naq (4,4), gura (1,4) jvyy fubj hc nf n jbys ab znggre jung, fvapr ur'f va gur fnzr ebj, pbyhza, naq qvntbany nf n jbys.
$endgroup$
– cag51
yesterday
|
show 6 more comments
$begingroup$
I think this can be done in 39 tests.
Arrange the sheep in a 10x10 grid. Collect a sample from each row, column, and
the diagonals in one direction. Once the results come back, draw a line across
the grid for each positive test result. When three lines intersect, that's a
wolf!
As a quick example, after arranging 25 sheep into a grid, we have the following:
S S W S S
S W S S S
S S S S S
S S S S W
S S S S S
This gives us positive test results for rows 1, 2, 4, columns 2, 3, 5, and diagonals (/starting from the top left) 3, 8.
- 2 3 - 2
- 3 2 - 2
/ | | |
- 2 2 - 3
| | / |
This shows the wolves where there are 3 overlaps. It also shows the need for the diagonals - there are overlaps of 2 lines, which are just sheep that happen to line up with wolves. Without the diagonals, we wouldn't be able to tell the difference.
Unfortunately, as has been pointed out in the comments, there are some edge cases where this solution does not narrow down the results to only 5 wolves.
W S S
W S S
W W W
This results in a false positive on all of the sheep.
Edit
I've been thinking more about the maths behind this, and would like to try to refine it. The base line is testing all 100 sheep, which guarantees 5/100 positives and the rest negative.
In my answer above, I divide the sheep into groups of 10, which guarantees 5/10 positives and 5/10 negatives. By doing this, I've halved the number of sheep to search with only 10 samples.
As you can see with the grid example, by splitting the sheep in a different way, i.e. rows instead of columns, I can perform the search again and narrow down to 25 sheep with only 20 tests.
I don't exactly know how to explain what makes the distribution special, but when the sheep are arranged in a grid, I can use the following function to redistribute the sheep into new groups for each test:group(x, y, test) = (x + (y * test)) % 10
(With each iteration, shuffle each row across to the left according to its row number, e.g row 0 stays where it is, row 1 gets shuffled 1 to the left, row 2 gets shuffled 2 to the left).
With this distribution function, we can keep adding iterations to narrow down the suspected sheep, until the number is less than or equal to 5:suspects = 100 * ((5 / 10) ^ iterations)
In order to be certain, we need to repeat this 5 times, which is 50 tests.
I think this might work for other group sizes as well:suspects = 100 * ((5 / groups) ^ iterations)
Groups | Iterations | Samples
-------|------------|---------
7 | 9 | 63
8 | 7 | 56
9 | 6 | 54
10 | 5 | 50
11 | 4 | 44
12 | 4 | 48
13 | 4 | 52
14 | 3 | 42
15 | 3 | 45
16 | 3 | 48
17 | 3 | 51
18 | 3 | 54
19 | 3 | 57
20 | 3 | 60
21 | 3 | 63
22 | 3 | 66
23 | 2 | 46
So using this method, with a group size of 14 and 3 iterations, it looks like it might be possible with 42 tests to determine the wolves. However, I haven't managed to prove this, I think I've spent enough time on this puzzle. I also wondered whether it is possible to arrange the sheep in a cube instead of a grid, but I never managed to work it out.
New contributor
Andrew Williamson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
$begingroup$
+1! Are the diagonals required?
$endgroup$
– user45266
yesterday
$begingroup$
Could you elaborate on how the number 39 is obtained. Also more details on how the testing is done can help the reader understand it better.
$endgroup$
– Jyotish Robin
yesterday
$begingroup$
Oops, that's a spoiler, probably should learn that rot13 thing I see everywhere on this site
$endgroup$
– Andrew Williamson
yesterday
$begingroup$
It would be better if you could add the additional info to the answer itself instead of the comment.
$endgroup$
– Jyotish Robin
yesterday
1
$begingroup$
Love this solution, but I'm not sure that it's correct. rot13: Vs gurer ner jbyirf ng (1,5), (2,3), (3,2), naq (4,4), gura (1,4) jvyy fubj hc nf n jbys ab znggre jung, fvapr ur'f va gur fnzr ebj, pbyhza, naq qvntbany nf n jbys.
$endgroup$
– cag51
yesterday
|
show 6 more comments
$begingroup$
I think this can be done in 39 tests.
Arrange the sheep in a 10x10 grid. Collect a sample from each row, column, and
the diagonals in one direction. Once the results come back, draw a line across
the grid for each positive test result. When three lines intersect, that's a
wolf!
As a quick example, after arranging 25 sheep into a grid, we have the following:
S S W S S
S W S S S
S S S S S
S S S S W
S S S S S
This gives us positive test results for rows 1, 2, 4, columns 2, 3, 5, and diagonals (/starting from the top left) 3, 8.
- 2 3 - 2
- 3 2 - 2
/ | | |
- 2 2 - 3
| | / |
This shows the wolves where there are 3 overlaps. It also shows the need for the diagonals - there are overlaps of 2 lines, which are just sheep that happen to line up with wolves. Without the diagonals, we wouldn't be able to tell the difference.
Unfortunately, as has been pointed out in the comments, there are some edge cases where this solution does not narrow down the results to only 5 wolves.
W S S
W S S
W W W
This results in a false positive on all of the sheep.
Edit
I've been thinking more about the maths behind this, and would like to try to refine it. The base line is testing all 100 sheep, which guarantees 5/100 positives and the rest negative.
In my answer above, I divide the sheep into groups of 10, which guarantees 5/10 positives and 5/10 negatives. By doing this, I've halved the number of sheep to search with only 10 samples.
As you can see with the grid example, by splitting the sheep in a different way, i.e. rows instead of columns, I can perform the search again and narrow down to 25 sheep with only 20 tests.
I don't exactly know how to explain what makes the distribution special, but when the sheep are arranged in a grid, I can use the following function to redistribute the sheep into new groups for each test:group(x, y, test) = (x + (y * test)) % 10
(With each iteration, shuffle each row across to the left according to its row number, e.g row 0 stays where it is, row 1 gets shuffled 1 to the left, row 2 gets shuffled 2 to the left).
With this distribution function, we can keep adding iterations to narrow down the suspected sheep, until the number is less than or equal to 5:suspects = 100 * ((5 / 10) ^ iterations)
In order to be certain, we need to repeat this 5 times, which is 50 tests.
I think this might work for other group sizes as well:suspects = 100 * ((5 / groups) ^ iterations)
Groups | Iterations | Samples
-------|------------|---------
7 | 9 | 63
8 | 7 | 56
9 | 6 | 54
10 | 5 | 50
11 | 4 | 44
12 | 4 | 48
13 | 4 | 52
14 | 3 | 42
15 | 3 | 45
16 | 3 | 48
17 | 3 | 51
18 | 3 | 54
19 | 3 | 57
20 | 3 | 60
21 | 3 | 63
22 | 3 | 66
23 | 2 | 46
So using this method, with a group size of 14 and 3 iterations, it looks like it might be possible with 42 tests to determine the wolves. However, I haven't managed to prove this, I think I've spent enough time on this puzzle. I also wondered whether it is possible to arrange the sheep in a cube instead of a grid, but I never managed to work it out.
New contributor
Andrew Williamson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
I think this can be done in 39 tests.
Arrange the sheep in a 10x10 grid. Collect a sample from each row, column, and
the diagonals in one direction. Once the results come back, draw a line across
the grid for each positive test result. When three lines intersect, that's a
wolf!
As a quick example, after arranging 25 sheep into a grid, we have the following:
S S W S S
S W S S S
S S S S S
S S S S W
S S S S S
This gives us positive test results for rows 1, 2, 4, columns 2, 3, 5, and diagonals (/starting from the top left) 3, 8.
- 2 3 - 2
- 3 2 - 2
/ | | |
- 2 2 - 3
| | / |
This shows the wolves where there are 3 overlaps. It also shows the need for the diagonals - there are overlaps of 2 lines, which are just sheep that happen to line up with wolves. Without the diagonals, we wouldn't be able to tell the difference.
Unfortunately, as has been pointed out in the comments, there are some edge cases where this solution does not narrow down the results to only 5 wolves.
W S S
W S S
W W W
This results in a false positive on all of the sheep.
Edit
I've been thinking more about the maths behind this, and would like to try to refine it. The base line is testing all 100 sheep, which guarantees 5/100 positives and the rest negative.
In my answer above, I divide the sheep into groups of 10, which guarantees 5/10 positives and 5/10 negatives. By doing this, I've halved the number of sheep to search with only 10 samples.
As you can see with the grid example, by splitting the sheep in a different way, i.e. rows instead of columns, I can perform the search again and narrow down to 25 sheep with only 20 tests.
I don't exactly know how to explain what makes the distribution special, but when the sheep are arranged in a grid, I can use the following function to redistribute the sheep into new groups for each test:group(x, y, test) = (x + (y * test)) % 10
(With each iteration, shuffle each row across to the left according to its row number, e.g row 0 stays where it is, row 1 gets shuffled 1 to the left, row 2 gets shuffled 2 to the left).
With this distribution function, we can keep adding iterations to narrow down the suspected sheep, until the number is less than or equal to 5:suspects = 100 * ((5 / 10) ^ iterations)
In order to be certain, we need to repeat this 5 times, which is 50 tests.
I think this might work for other group sizes as well:suspects = 100 * ((5 / groups) ^ iterations)
Groups | Iterations | Samples
-------|------------|---------
7 | 9 | 63
8 | 7 | 56
9 | 6 | 54
10 | 5 | 50
11 | 4 | 44
12 | 4 | 48
13 | 4 | 52
14 | 3 | 42
15 | 3 | 45
16 | 3 | 48
17 | 3 | 51
18 | 3 | 54
19 | 3 | 57
20 | 3 | 60
21 | 3 | 63
22 | 3 | 66
23 | 2 | 46
So using this method, with a group size of 14 and 3 iterations, it looks like it might be possible with 42 tests to determine the wolves. However, I haven't managed to prove this, I think I've spent enough time on this puzzle. I also wondered whether it is possible to arrange the sheep in a cube instead of a grid, but I never managed to work it out.
New contributor
Andrew Williamson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited yesterday
New contributor
Andrew Williamson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered yesterday
Andrew WilliamsonAndrew Williamson
1693
1693
New contributor
Andrew Williamson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Andrew Williamson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Andrew Williamson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$begingroup$
+1! Are the diagonals required?
$endgroup$
– user45266
yesterday
$begingroup$
Could you elaborate on how the number 39 is obtained. Also more details on how the testing is done can help the reader understand it better.
$endgroup$
– Jyotish Robin
yesterday
$begingroup$
Oops, that's a spoiler, probably should learn that rot13 thing I see everywhere on this site
$endgroup$
– Andrew Williamson
yesterday
$begingroup$
It would be better if you could add the additional info to the answer itself instead of the comment.
$endgroup$
– Jyotish Robin
yesterday
1
$begingroup$
Love this solution, but I'm not sure that it's correct. rot13: Vs gurer ner jbyirf ng (1,5), (2,3), (3,2), naq (4,4), gura (1,4) jvyy fubj hc nf n jbys ab znggre jung, fvapr ur'f va gur fnzr ebj, pbyhza, naq qvntbany nf n jbys.
$endgroup$
– cag51
yesterday
|
show 6 more comments
$begingroup$
+1! Are the diagonals required?
$endgroup$
– user45266
yesterday
$begingroup$
Could you elaborate on how the number 39 is obtained. Also more details on how the testing is done can help the reader understand it better.
$endgroup$
– Jyotish Robin
yesterday
$begingroup$
Oops, that's a spoiler, probably should learn that rot13 thing I see everywhere on this site
$endgroup$
– Andrew Williamson
yesterday
$begingroup$
It would be better if you could add the additional info to the answer itself instead of the comment.
$endgroup$
– Jyotish Robin
yesterday
1
$begingroup$
Love this solution, but I'm not sure that it's correct. rot13: Vs gurer ner jbyirf ng (1,5), (2,3), (3,2), naq (4,4), gura (1,4) jvyy fubj hc nf n jbys ab znggre jung, fvapr ur'f va gur fnzr ebj, pbyhza, naq qvntbany nf n jbys.
$endgroup$
– cag51
yesterday
$begingroup$
+1! Are the diagonals required?
$endgroup$
– user45266
yesterday
$begingroup$
+1! Are the diagonals required?
$endgroup$
– user45266
yesterday
$begingroup$
Could you elaborate on how the number 39 is obtained. Also more details on how the testing is done can help the reader understand it better.
$endgroup$
– Jyotish Robin
yesterday
$begingroup$
Could you elaborate on how the number 39 is obtained. Also more details on how the testing is done can help the reader understand it better.
$endgroup$
– Jyotish Robin
yesterday
$begingroup$
Oops, that's a spoiler, probably should learn that rot13 thing I see everywhere on this site
$endgroup$
– Andrew Williamson
yesterday
$begingroup$
Oops, that's a spoiler, probably should learn that rot13 thing I see everywhere on this site
$endgroup$
– Andrew Williamson
yesterday
$begingroup$
It would be better if you could add the additional info to the answer itself instead of the comment.
$endgroup$
– Jyotish Robin
yesterday
$begingroup$
It would be better if you could add the additional info to the answer itself instead of the comment.
$endgroup$
– Jyotish Robin
yesterday
1
1
$begingroup$
Love this solution, but I'm not sure that it's correct. rot13: Vs gurer ner jbyirf ng (1,5), (2,3), (3,2), naq (4,4), gura (1,4) jvyy fubj hc nf n jbys ab znggre jung, fvapr ur'f va gur fnzr ebj, pbyhza, naq qvntbany nf n jbys.
$endgroup$
– cag51
yesterday
$begingroup$
Love this solution, but I'm not sure that it's correct. rot13: Vs gurer ner jbyirf ng (1,5), (2,3), (3,2), naq (4,4), gura (1,4) jvyy fubj hc nf n jbys ab znggre jung, fvapr ur'f va gur fnzr ebj, pbyhza, naq qvntbany nf n jbys.
$endgroup$
– cag51
yesterday
|
show 6 more comments
$begingroup$
Thinking out loud, not a solution yet, but spoilery enough that I didn't want to put it in a comment:
There are $100choose 5 > 2^26$ possible arrangements of the 5 wolves among 100 sheep. This indicates that we must use at least 27 tests, no matter what — that's just basic information theory.
Could we design a strategy to use the bare minimum? Well, if there were just one wolf, then yes we could. There are $100choose 1 > 2^6$ possible arrangements of a single wolf among 100 sheep. Assign each arrangement a number; express each number in binary (using 7 bits); then perform 7 tests to determine which arrangement is the right one. This is The blood test riddle (number theory) by another name.
However,
if there are two wolves, then I have seen proof that we cannot always do it in the bare information-theoretical minimum number of tests. Suppose we have 6 sheep, two of whom are wolves. There are $6choose 2 = 15 leq 2^4$ possible arrangements of two wolves among 6 sheep. But I wrote a little Python script to do a brute-force exhaustive search, and it concluded that there is no way to unambiguously identify the two wolves out of six sheep, using only four blood tests.
This is evidence that the solution to this puzzle probably (but not definitely) requires more than 27 tests.
Still-not-an-answer UPDATE:
According to my new and improved brute-force script,
There is no way to find 2,3,4,5 wolves among 6 sheep in fewer than 5 tests.
There is no way to find 2,3,4,5,6 wolves among 7 sheep in fewer than 6 tests.
There is no way to find 3,4,5,6,7 wolves among 8 sheep in fewer than 7 tests.
There is no way to find 3,4,5,6,7 wolves among 9 sheep in fewer than 8 tests.
However,
to find 2 wolves among 8 sheep, we don't need 7 tests — we can do it in 6 tests!
Test 1. T . . T T . . .
Test 2. T . . . . T T .
Test 3. . T . T . T . .
Test 4. . T . . T . T .
Test 5. . . T . T T . .
Test 6. . . T T . . T .
Notice the nice symmetry of the first three columns (sheep), and then what we do with the next four columns in each pair of rows (tests). The eighth sheep doesn't need to be tested at all; we can figure him out by deductive reasoning.
So this is evidence that perhaps the original puzzle can be done in fewer than 99 tests!
I also notice that the situation is not symmetrical: we may know a way to find $k$ wolves among $n$ sheep using $t$ tests, but that won't help us at all to find $n-k$ wolves among $n$ sheep. (Under the spoiler tags above, I show one concrete example where $n,k,t$ is possible yet $n,n-k,t$ is not possible.)
$endgroup$
$begingroup$
Your calculations confirm my suspicions. I was trying to figure out a process to arrive at the heavy-handed hint of 100C5 and 2^27 by assigning each permutation to a single binary number, but that fails miserably. The only saving grace was that 2^27 is almost twice as large as 100C5, so not all binary numbers have to be represented. Alas, I still cannot find a way.
$endgroup$
– Amorydai
1 hour ago
add a comment |
$begingroup$
Thinking out loud, not a solution yet, but spoilery enough that I didn't want to put it in a comment:
There are $100choose 5 > 2^26$ possible arrangements of the 5 wolves among 100 sheep. This indicates that we must use at least 27 tests, no matter what — that's just basic information theory.
Could we design a strategy to use the bare minimum? Well, if there were just one wolf, then yes we could. There are $100choose 1 > 2^6$ possible arrangements of a single wolf among 100 sheep. Assign each arrangement a number; express each number in binary (using 7 bits); then perform 7 tests to determine which arrangement is the right one. This is The blood test riddle (number theory) by another name.
However,
if there are two wolves, then I have seen proof that we cannot always do it in the bare information-theoretical minimum number of tests. Suppose we have 6 sheep, two of whom are wolves. There are $6choose 2 = 15 leq 2^4$ possible arrangements of two wolves among 6 sheep. But I wrote a little Python script to do a brute-force exhaustive search, and it concluded that there is no way to unambiguously identify the two wolves out of six sheep, using only four blood tests.
This is evidence that the solution to this puzzle probably (but not definitely) requires more than 27 tests.
Still-not-an-answer UPDATE:
According to my new and improved brute-force script,
There is no way to find 2,3,4,5 wolves among 6 sheep in fewer than 5 tests.
There is no way to find 2,3,4,5,6 wolves among 7 sheep in fewer than 6 tests.
There is no way to find 3,4,5,6,7 wolves among 8 sheep in fewer than 7 tests.
There is no way to find 3,4,5,6,7 wolves among 9 sheep in fewer than 8 tests.
However,
to find 2 wolves among 8 sheep, we don't need 7 tests — we can do it in 6 tests!
Test 1. T . . T T . . .
Test 2. T . . . . T T .
Test 3. . T . T . T . .
Test 4. . T . . T . T .
Test 5. . . T . T T . .
Test 6. . . T T . . T .
Notice the nice symmetry of the first three columns (sheep), and then what we do with the next four columns in each pair of rows (tests). The eighth sheep doesn't need to be tested at all; we can figure him out by deductive reasoning.
So this is evidence that perhaps the original puzzle can be done in fewer than 99 tests!
I also notice that the situation is not symmetrical: we may know a way to find $k$ wolves among $n$ sheep using $t$ tests, but that won't help us at all to find $n-k$ wolves among $n$ sheep. (Under the spoiler tags above, I show one concrete example where $n,k,t$ is possible yet $n,n-k,t$ is not possible.)
$endgroup$
$begingroup$
Your calculations confirm my suspicions. I was trying to figure out a process to arrive at the heavy-handed hint of 100C5 and 2^27 by assigning each permutation to a single binary number, but that fails miserably. The only saving grace was that 2^27 is almost twice as large as 100C5, so not all binary numbers have to be represented. Alas, I still cannot find a way.
$endgroup$
– Amorydai
1 hour ago
add a comment |
$begingroup$
Thinking out loud, not a solution yet, but spoilery enough that I didn't want to put it in a comment:
There are $100choose 5 > 2^26$ possible arrangements of the 5 wolves among 100 sheep. This indicates that we must use at least 27 tests, no matter what — that's just basic information theory.
Could we design a strategy to use the bare minimum? Well, if there were just one wolf, then yes we could. There are $100choose 1 > 2^6$ possible arrangements of a single wolf among 100 sheep. Assign each arrangement a number; express each number in binary (using 7 bits); then perform 7 tests to determine which arrangement is the right one. This is The blood test riddle (number theory) by another name.
However,
if there are two wolves, then I have seen proof that we cannot always do it in the bare information-theoretical minimum number of tests. Suppose we have 6 sheep, two of whom are wolves. There are $6choose 2 = 15 leq 2^4$ possible arrangements of two wolves among 6 sheep. But I wrote a little Python script to do a brute-force exhaustive search, and it concluded that there is no way to unambiguously identify the two wolves out of six sheep, using only four blood tests.
This is evidence that the solution to this puzzle probably (but not definitely) requires more than 27 tests.
Still-not-an-answer UPDATE:
According to my new and improved brute-force script,
There is no way to find 2,3,4,5 wolves among 6 sheep in fewer than 5 tests.
There is no way to find 2,3,4,5,6 wolves among 7 sheep in fewer than 6 tests.
There is no way to find 3,4,5,6,7 wolves among 8 sheep in fewer than 7 tests.
There is no way to find 3,4,5,6,7 wolves among 9 sheep in fewer than 8 tests.
However,
to find 2 wolves among 8 sheep, we don't need 7 tests — we can do it in 6 tests!
Test 1. T . . T T . . .
Test 2. T . . . . T T .
Test 3. . T . T . T . .
Test 4. . T . . T . T .
Test 5. . . T . T T . .
Test 6. . . T T . . T .
Notice the nice symmetry of the first three columns (sheep), and then what we do with the next four columns in each pair of rows (tests). The eighth sheep doesn't need to be tested at all; we can figure him out by deductive reasoning.
So this is evidence that perhaps the original puzzle can be done in fewer than 99 tests!
I also notice that the situation is not symmetrical: we may know a way to find $k$ wolves among $n$ sheep using $t$ tests, but that won't help us at all to find $n-k$ wolves among $n$ sheep. (Under the spoiler tags above, I show one concrete example where $n,k,t$ is possible yet $n,n-k,t$ is not possible.)
$endgroup$
Thinking out loud, not a solution yet, but spoilery enough that I didn't want to put it in a comment:
There are $100choose 5 > 2^26$ possible arrangements of the 5 wolves among 100 sheep. This indicates that we must use at least 27 tests, no matter what — that's just basic information theory.
Could we design a strategy to use the bare minimum? Well, if there were just one wolf, then yes we could. There are $100choose 1 > 2^6$ possible arrangements of a single wolf among 100 sheep. Assign each arrangement a number; express each number in binary (using 7 bits); then perform 7 tests to determine which arrangement is the right one. This is The blood test riddle (number theory) by another name.
However,
if there are two wolves, then I have seen proof that we cannot always do it in the bare information-theoretical minimum number of tests. Suppose we have 6 sheep, two of whom are wolves. There are $6choose 2 = 15 leq 2^4$ possible arrangements of two wolves among 6 sheep. But I wrote a little Python script to do a brute-force exhaustive search, and it concluded that there is no way to unambiguously identify the two wolves out of six sheep, using only four blood tests.
This is evidence that the solution to this puzzle probably (but not definitely) requires more than 27 tests.
Still-not-an-answer UPDATE:
According to my new and improved brute-force script,
There is no way to find 2,3,4,5 wolves among 6 sheep in fewer than 5 tests.
There is no way to find 2,3,4,5,6 wolves among 7 sheep in fewer than 6 tests.
There is no way to find 3,4,5,6,7 wolves among 8 sheep in fewer than 7 tests.
There is no way to find 3,4,5,6,7 wolves among 9 sheep in fewer than 8 tests.
However,
to find 2 wolves among 8 sheep, we don't need 7 tests — we can do it in 6 tests!
Test 1. T . . T T . . .
Test 2. T . . . . T T .
Test 3. . T . T . T . .
Test 4. . T . . T . T .
Test 5. . . T . T T . .
Test 6. . . T T . . T .
Notice the nice symmetry of the first three columns (sheep), and then what we do with the next four columns in each pair of rows (tests). The eighth sheep doesn't need to be tested at all; we can figure him out by deductive reasoning.
So this is evidence that perhaps the original puzzle can be done in fewer than 99 tests!
I also notice that the situation is not symmetrical: we may know a way to find $k$ wolves among $n$ sheep using $t$ tests, but that won't help us at all to find $n-k$ wolves among $n$ sheep. (Under the spoiler tags above, I show one concrete example where $n,k,t$ is possible yet $n,n-k,t$ is not possible.)
edited 3 hours ago
answered 20 hours ago
QuuxplusoneQuuxplusone
408212
408212
$begingroup$
Your calculations confirm my suspicions. I was trying to figure out a process to arrive at the heavy-handed hint of 100C5 and 2^27 by assigning each permutation to a single binary number, but that fails miserably. The only saving grace was that 2^27 is almost twice as large as 100C5, so not all binary numbers have to be represented. Alas, I still cannot find a way.
$endgroup$
– Amorydai
1 hour ago
add a comment |
$begingroup$
Your calculations confirm my suspicions. I was trying to figure out a process to arrive at the heavy-handed hint of 100C5 and 2^27 by assigning each permutation to a single binary number, but that fails miserably. The only saving grace was that 2^27 is almost twice as large as 100C5, so not all binary numbers have to be represented. Alas, I still cannot find a way.
$endgroup$
– Amorydai
1 hour ago
$begingroup$
Your calculations confirm my suspicions. I was trying to figure out a process to arrive at the heavy-handed hint of 100C5 and 2^27 by assigning each permutation to a single binary number, but that fails miserably. The only saving grace was that 2^27 is almost twice as large as 100C5, so not all binary numbers have to be represented. Alas, I still cannot find a way.
$endgroup$
– Amorydai
1 hour ago
$begingroup$
Your calculations confirm my suspicions. I was trying to figure out a process to arrive at the heavy-handed hint of 100C5 and 2^27 by assigning each permutation to a single binary number, but that fails miserably. The only saving grace was that 2^27 is almost twice as large as 100C5, so not all binary numbers have to be represented. Alas, I still cannot find a way.
$endgroup$
– Amorydai
1 hour ago
add a comment |
$begingroup$
Here's my shot at it:
Pool 50 of the sheep. Of those 50, if the result comes back positive (wolf detected), split in half again, testing 25 pooled together. If this comes back positive, either 12 or 13 ofthe positive group. You see where this is going. Any negative results rule out all sheep in that group. Worst case scenario, it takes 54 tests (see image for explanation). Best case scenario, you get 14 tests. Price range: 14,000 - 54,000 dollars.
Not sure yet of the expected average, but I know this is better than 99 tests on average.
Diagram:
If this isn't the optimal solution, then my best bet on how to improve it would be to:
split into 1/5 the size of each group.
EDIT: Apparently, you can only do all your tests in one step. So that means you need 99 tests (the last one is obvious, it's either the 95th sheep or the 5th wolf), unless I'm missing something. Cost: $99,000.
$endgroup$
1
$begingroup$
You forgot that the test results are available to you only after all the tests are done!
$endgroup$
– Jyotish Robin
yesterday
$begingroup$
Oh, shoot. But how would that even work?! I can't really see any way to deduce the identities of all wolves in one step without 99 separate tests! I hope you know the answer to this, because I really want to know now!
$endgroup$
– user45266
yesterday
$begingroup$
You can do multiple tests. But the catch is that you will only see the results at the end of all tests. I will wait for you or other bright heads to spend more time before I consider posting the answer :)
$endgroup$
– Jyotish Robin
yesterday
add a comment |
$begingroup$
Here's my shot at it:
Pool 50 of the sheep. Of those 50, if the result comes back positive (wolf detected), split in half again, testing 25 pooled together. If this comes back positive, either 12 or 13 ofthe positive group. You see where this is going. Any negative results rule out all sheep in that group. Worst case scenario, it takes 54 tests (see image for explanation). Best case scenario, you get 14 tests. Price range: 14,000 - 54,000 dollars.
Not sure yet of the expected average, but I know this is better than 99 tests on average.
Diagram:
If this isn't the optimal solution, then my best bet on how to improve it would be to:
split into 1/5 the size of each group.
EDIT: Apparently, you can only do all your tests in one step. So that means you need 99 tests (the last one is obvious, it's either the 95th sheep or the 5th wolf), unless I'm missing something. Cost: $99,000.
$endgroup$
1
$begingroup$
You forgot that the test results are available to you only after all the tests are done!
$endgroup$
– Jyotish Robin
yesterday
$begingroup$
Oh, shoot. But how would that even work?! I can't really see any way to deduce the identities of all wolves in one step without 99 separate tests! I hope you know the answer to this, because I really want to know now!
$endgroup$
– user45266
yesterday
$begingroup$
You can do multiple tests. But the catch is that you will only see the results at the end of all tests. I will wait for you or other bright heads to spend more time before I consider posting the answer :)
$endgroup$
– Jyotish Robin
yesterday
add a comment |
$begingroup$
Here's my shot at it:
Pool 50 of the sheep. Of those 50, if the result comes back positive (wolf detected), split in half again, testing 25 pooled together. If this comes back positive, either 12 or 13 ofthe positive group. You see where this is going. Any negative results rule out all sheep in that group. Worst case scenario, it takes 54 tests (see image for explanation). Best case scenario, you get 14 tests. Price range: 14,000 - 54,000 dollars.
Not sure yet of the expected average, but I know this is better than 99 tests on average.
Diagram:
If this isn't the optimal solution, then my best bet on how to improve it would be to:
split into 1/5 the size of each group.
EDIT: Apparently, you can only do all your tests in one step. So that means you need 99 tests (the last one is obvious, it's either the 95th sheep or the 5th wolf), unless I'm missing something. Cost: $99,000.
$endgroup$
Here's my shot at it:
Pool 50 of the sheep. Of those 50, if the result comes back positive (wolf detected), split in half again, testing 25 pooled together. If this comes back positive, either 12 or 13 ofthe positive group. You see where this is going. Any negative results rule out all sheep in that group. Worst case scenario, it takes 54 tests (see image for explanation). Best case scenario, you get 14 tests. Price range: 14,000 - 54,000 dollars.
Not sure yet of the expected average, but I know this is better than 99 tests on average.
Diagram:
If this isn't the optimal solution, then my best bet on how to improve it would be to:
split into 1/5 the size of each group.
EDIT: Apparently, you can only do all your tests in one step. So that means you need 99 tests (the last one is obvious, it's either the 95th sheep or the 5th wolf), unless I'm missing something. Cost: $99,000.
edited yesterday
answered yesterday
user45266user45266
33514
33514
1
$begingroup$
You forgot that the test results are available to you only after all the tests are done!
$endgroup$
– Jyotish Robin
yesterday
$begingroup$
Oh, shoot. But how would that even work?! I can't really see any way to deduce the identities of all wolves in one step without 99 separate tests! I hope you know the answer to this, because I really want to know now!
$endgroup$
– user45266
yesterday
$begingroup$
You can do multiple tests. But the catch is that you will only see the results at the end of all tests. I will wait for you or other bright heads to spend more time before I consider posting the answer :)
$endgroup$
– Jyotish Robin
yesterday
add a comment |
1
$begingroup$
You forgot that the test results are available to you only after all the tests are done!
$endgroup$
– Jyotish Robin
yesterday
$begingroup$
Oh, shoot. But how would that even work?! I can't really see any way to deduce the identities of all wolves in one step without 99 separate tests! I hope you know the answer to this, because I really want to know now!
$endgroup$
– user45266
yesterday
$begingroup$
You can do multiple tests. But the catch is that you will only see the results at the end of all tests. I will wait for you or other bright heads to spend more time before I consider posting the answer :)
$endgroup$
– Jyotish Robin
yesterday
1
1
$begingroup$
You forgot that the test results are available to you only after all the tests are done!
$endgroup$
– Jyotish Robin
yesterday
$begingroup$
You forgot that the test results are available to you only after all the tests are done!
$endgroup$
– Jyotish Robin
yesterday
$begingroup$
Oh, shoot. But how would that even work?! I can't really see any way to deduce the identities of all wolves in one step without 99 separate tests! I hope you know the answer to this, because I really want to know now!
$endgroup$
– user45266
yesterday
$begingroup$
Oh, shoot. But how would that even work?! I can't really see any way to deduce the identities of all wolves in one step without 99 separate tests! I hope you know the answer to this, because I really want to know now!
$endgroup$
– user45266
yesterday
$begingroup$
You can do multiple tests. But the catch is that you will only see the results at the end of all tests. I will wait for you or other bright heads to spend more time before I consider posting the answer :)
$endgroup$
– Jyotish Robin
yesterday
$begingroup$
You can do multiple tests. But the catch is that you will only see the results at the end of all tests. I will wait for you or other bright heads to spend more time before I consider posting the answer :)
$endgroup$
– Jyotish Robin
yesterday
add a comment |
$begingroup$
I can do it in about 28 tests.
As Quuxplusone pointed out, for 5 wolves hiding among 100 sheep, there are $100 choose 5 approx 2^26.2$ scenarios. Thus you need at least 27 tests.
$ $
To solve this, we essentially perform 5 binary searches, each to find the first remaining unidentified wolf. But we don't want to simply split the group in half; there is about a 97% chance that the first wolf is in the first 50. The key is to recognize that the goal of each step in a binary search is not to cut the group in half, but to cut the number of scenarios in half.
$ $
If we test $n$ animals out of 100, of which 5 are wolves, then the probability of getting a "no" is $P(n;5,100) = 100-n choose 5 over 100 choose 5$. The goal is to select $n$ so that ratio is as close to 50% as possible. Also, if $n$ is not too large, then if the answer is yes, the odds are good that there is only one wolf in the test group, so a standard binary search is the best way to identify the wolf within the group. For efficiency, $n$ should always be a power of 2.
$ $
For 100 sheep, the first $n$ should thus be 16. A "no" answer would reduce the number of possibilities from 75 million to 30 million. While 13 would give a more exact split (37 million), a binary search on 13 animals takes as many tests as a binary search on 16, so we might as well test 16.
$ $
If the answer is no, we would test the next 16, where a "no" would reduce the number of possibilities to 10 million. As long as we kept getting "no", we could continue testing at 8, 8, 8, 8, 4, 4, 4, 4, 2, 2, 2, 2. After that we would be down to 12 animals and there would be no point in testing more than one at a time. Thus, if all 5 wolves are among the last twelve, that would lead to 21 to 25 tests.
$ $
Far more likely is the chance that some of the tests would yield "yes". There's an 87% chance that one of the first two tests would yield "yes". That would identify the first wolf as one of a group of 16. A standard binary search (first 8, then first 4 of one half, etc.) takes 4 more tests to identify the first wolf.
$ $
A side-effect of this approach is that once the first wolf is identified, all earlier animals are known to be sheep (because they were each part of a group that tested no). Worst case scenario is where the first animal is a wolf, in which case we took 5 tests to determine that, but learned nothing else.
$ $
Once we have determined the first wolf, we continue with the remaining wolves. Worst case is we have 99 more animals, of which 4 are wolves. In this case, testing 16 animals would cut the remaining scenarios roughly in half. Etc.
$ $
If the first three wolves are the first three animals, it would take 15 tests to identify them and learn nothing else. We then have 97 more animals, of which 2 are wolves (a total of 4656 combinations). We would want to test more than 16 animals to split the scenarios effectively. Testing 32 would split the scnearios to 2080 for no, or 2576 for yes.
$ $
The goal is that each "no" should reduce the set of remaining scenarios to less than half the previous. Each "yes" would then be followed by a binary search of several tests which each cut the number of scenarios almost exactly in half. Thus, we should be able to remain very close to the ideal number of tests.
$ $
A possible worst case, where we learn the minimum amount from each test, is when the wolves are the first 5 animals, yielding "yes" answers every time. That would take 5 tests to identify the first wolf, 5 more to identify the second, 5 to identify the third, 6 to identify the fourth, and 7 to identify the last, for a total of 28 tests.
It is possible that there is a scenario that requires more than 28 tests, but we would have to go through thousands of scenarios to check each to see which is worst. In any case, it should not be worse by more than one or two additional tests.
$endgroup$
1
$begingroup$
Oh, if you need to do all the tests at once, this obviously won't work. Nevermind then.
$endgroup$
– user3294068
5 hours ago
add a comment |
$begingroup$
I can do it in about 28 tests.
As Quuxplusone pointed out, for 5 wolves hiding among 100 sheep, there are $100 choose 5 approx 2^26.2$ scenarios. Thus you need at least 27 tests.
$ $
To solve this, we essentially perform 5 binary searches, each to find the first remaining unidentified wolf. But we don't want to simply split the group in half; there is about a 97% chance that the first wolf is in the first 50. The key is to recognize that the goal of each step in a binary search is not to cut the group in half, but to cut the number of scenarios in half.
$ $
If we test $n$ animals out of 100, of which 5 are wolves, then the probability of getting a "no" is $P(n;5,100) = 100-n choose 5 over 100 choose 5$. The goal is to select $n$ so that ratio is as close to 50% as possible. Also, if $n$ is not too large, then if the answer is yes, the odds are good that there is only one wolf in the test group, so a standard binary search is the best way to identify the wolf within the group. For efficiency, $n$ should always be a power of 2.
$ $
For 100 sheep, the first $n$ should thus be 16. A "no" answer would reduce the number of possibilities from 75 million to 30 million. While 13 would give a more exact split (37 million), a binary search on 13 animals takes as many tests as a binary search on 16, so we might as well test 16.
$ $
If the answer is no, we would test the next 16, where a "no" would reduce the number of possibilities to 10 million. As long as we kept getting "no", we could continue testing at 8, 8, 8, 8, 4, 4, 4, 4, 2, 2, 2, 2. After that we would be down to 12 animals and there would be no point in testing more than one at a time. Thus, if all 5 wolves are among the last twelve, that would lead to 21 to 25 tests.
$ $
Far more likely is the chance that some of the tests would yield "yes". There's an 87% chance that one of the first two tests would yield "yes". That would identify the first wolf as one of a group of 16. A standard binary search (first 8, then first 4 of one half, etc.) takes 4 more tests to identify the first wolf.
$ $
A side-effect of this approach is that once the first wolf is identified, all earlier animals are known to be sheep (because they were each part of a group that tested no). Worst case scenario is where the first animal is a wolf, in which case we took 5 tests to determine that, but learned nothing else.
$ $
Once we have determined the first wolf, we continue with the remaining wolves. Worst case is we have 99 more animals, of which 4 are wolves. In this case, testing 16 animals would cut the remaining scenarios roughly in half. Etc.
$ $
If the first three wolves are the first three animals, it would take 15 tests to identify them and learn nothing else. We then have 97 more animals, of which 2 are wolves (a total of 4656 combinations). We would want to test more than 16 animals to split the scenarios effectively. Testing 32 would split the scnearios to 2080 for no, or 2576 for yes.
$ $
The goal is that each "no" should reduce the set of remaining scenarios to less than half the previous. Each "yes" would then be followed by a binary search of several tests which each cut the number of scenarios almost exactly in half. Thus, we should be able to remain very close to the ideal number of tests.
$ $
A possible worst case, where we learn the minimum amount from each test, is when the wolves are the first 5 animals, yielding "yes" answers every time. That would take 5 tests to identify the first wolf, 5 more to identify the second, 5 to identify the third, 6 to identify the fourth, and 7 to identify the last, for a total of 28 tests.
It is possible that there is a scenario that requires more than 28 tests, but we would have to go through thousands of scenarios to check each to see which is worst. In any case, it should not be worse by more than one or two additional tests.
$endgroup$
1
$begingroup$
Oh, if you need to do all the tests at once, this obviously won't work. Nevermind then.
$endgroup$
– user3294068
5 hours ago
add a comment |
$begingroup$
I can do it in about 28 tests.
As Quuxplusone pointed out, for 5 wolves hiding among 100 sheep, there are $100 choose 5 approx 2^26.2$ scenarios. Thus you need at least 27 tests.
$ $
To solve this, we essentially perform 5 binary searches, each to find the first remaining unidentified wolf. But we don't want to simply split the group in half; there is about a 97% chance that the first wolf is in the first 50. The key is to recognize that the goal of each step in a binary search is not to cut the group in half, but to cut the number of scenarios in half.
$ $
If we test $n$ animals out of 100, of which 5 are wolves, then the probability of getting a "no" is $P(n;5,100) = 100-n choose 5 over 100 choose 5$. The goal is to select $n$ so that ratio is as close to 50% as possible. Also, if $n$ is not too large, then if the answer is yes, the odds are good that there is only one wolf in the test group, so a standard binary search is the best way to identify the wolf within the group. For efficiency, $n$ should always be a power of 2.
$ $
For 100 sheep, the first $n$ should thus be 16. A "no" answer would reduce the number of possibilities from 75 million to 30 million. While 13 would give a more exact split (37 million), a binary search on 13 animals takes as many tests as a binary search on 16, so we might as well test 16.
$ $
If the answer is no, we would test the next 16, where a "no" would reduce the number of possibilities to 10 million. As long as we kept getting "no", we could continue testing at 8, 8, 8, 8, 4, 4, 4, 4, 2, 2, 2, 2. After that we would be down to 12 animals and there would be no point in testing more than one at a time. Thus, if all 5 wolves are among the last twelve, that would lead to 21 to 25 tests.
$ $
Far more likely is the chance that some of the tests would yield "yes". There's an 87% chance that one of the first two tests would yield "yes". That would identify the first wolf as one of a group of 16. A standard binary search (first 8, then first 4 of one half, etc.) takes 4 more tests to identify the first wolf.
$ $
A side-effect of this approach is that once the first wolf is identified, all earlier animals are known to be sheep (because they were each part of a group that tested no). Worst case scenario is where the first animal is a wolf, in which case we took 5 tests to determine that, but learned nothing else.
$ $
Once we have determined the first wolf, we continue with the remaining wolves. Worst case is we have 99 more animals, of which 4 are wolves. In this case, testing 16 animals would cut the remaining scenarios roughly in half. Etc.
$ $
If the first three wolves are the first three animals, it would take 15 tests to identify them and learn nothing else. We then have 97 more animals, of which 2 are wolves (a total of 4656 combinations). We would want to test more than 16 animals to split the scenarios effectively. Testing 32 would split the scnearios to 2080 for no, or 2576 for yes.
$ $
The goal is that each "no" should reduce the set of remaining scenarios to less than half the previous. Each "yes" would then be followed by a binary search of several tests which each cut the number of scenarios almost exactly in half. Thus, we should be able to remain very close to the ideal number of tests.
$ $
A possible worst case, where we learn the minimum amount from each test, is when the wolves are the first 5 animals, yielding "yes" answers every time. That would take 5 tests to identify the first wolf, 5 more to identify the second, 5 to identify the third, 6 to identify the fourth, and 7 to identify the last, for a total of 28 tests.
It is possible that there is a scenario that requires more than 28 tests, but we would have to go through thousands of scenarios to check each to see which is worst. In any case, it should not be worse by more than one or two additional tests.
$endgroup$
I can do it in about 28 tests.
As Quuxplusone pointed out, for 5 wolves hiding among 100 sheep, there are $100 choose 5 approx 2^26.2$ scenarios. Thus you need at least 27 tests.
$ $
To solve this, we essentially perform 5 binary searches, each to find the first remaining unidentified wolf. But we don't want to simply split the group in half; there is about a 97% chance that the first wolf is in the first 50. The key is to recognize that the goal of each step in a binary search is not to cut the group in half, but to cut the number of scenarios in half.
$ $
If we test $n$ animals out of 100, of which 5 are wolves, then the probability of getting a "no" is $P(n;5,100) = 100-n choose 5 over 100 choose 5$. The goal is to select $n$ so that ratio is as close to 50% as possible. Also, if $n$ is not too large, then if the answer is yes, the odds are good that there is only one wolf in the test group, so a standard binary search is the best way to identify the wolf within the group. For efficiency, $n$ should always be a power of 2.
$ $
For 100 sheep, the first $n$ should thus be 16. A "no" answer would reduce the number of possibilities from 75 million to 30 million. While 13 would give a more exact split (37 million), a binary search on 13 animals takes as many tests as a binary search on 16, so we might as well test 16.
$ $
If the answer is no, we would test the next 16, where a "no" would reduce the number of possibilities to 10 million. As long as we kept getting "no", we could continue testing at 8, 8, 8, 8, 4, 4, 4, 4, 2, 2, 2, 2. After that we would be down to 12 animals and there would be no point in testing more than one at a time. Thus, if all 5 wolves are among the last twelve, that would lead to 21 to 25 tests.
$ $
Far more likely is the chance that some of the tests would yield "yes". There's an 87% chance that one of the first two tests would yield "yes". That would identify the first wolf as one of a group of 16. A standard binary search (first 8, then first 4 of one half, etc.) takes 4 more tests to identify the first wolf.
$ $
A side-effect of this approach is that once the first wolf is identified, all earlier animals are known to be sheep (because they were each part of a group that tested no). Worst case scenario is where the first animal is a wolf, in which case we took 5 tests to determine that, but learned nothing else.
$ $
Once we have determined the first wolf, we continue with the remaining wolves. Worst case is we have 99 more animals, of which 4 are wolves. In this case, testing 16 animals would cut the remaining scenarios roughly in half. Etc.
$ $
If the first three wolves are the first three animals, it would take 15 tests to identify them and learn nothing else. We then have 97 more animals, of which 2 are wolves (a total of 4656 combinations). We would want to test more than 16 animals to split the scenarios effectively. Testing 32 would split the scnearios to 2080 for no, or 2576 for yes.
$ $
The goal is that each "no" should reduce the set of remaining scenarios to less than half the previous. Each "yes" would then be followed by a binary search of several tests which each cut the number of scenarios almost exactly in half. Thus, we should be able to remain very close to the ideal number of tests.
$ $
A possible worst case, where we learn the minimum amount from each test, is when the wolves are the first 5 animals, yielding "yes" answers every time. That would take 5 tests to identify the first wolf, 5 more to identify the second, 5 to identify the third, 6 to identify the fourth, and 7 to identify the last, for a total of 28 tests.
It is possible that there is a scenario that requires more than 28 tests, but we would have to go through thousands of scenarios to check each to see which is worst. In any case, it should not be worse by more than one or two additional tests.
answered 5 hours ago
user3294068user3294068
5,7741629
5,7741629
1
$begingroup$
Oh, if you need to do all the tests at once, this obviously won't work. Nevermind then.
$endgroup$
– user3294068
5 hours ago
add a comment |
1
$begingroup$
Oh, if you need to do all the tests at once, this obviously won't work. Nevermind then.
$endgroup$
– user3294068
5 hours ago
1
1
$begingroup$
Oh, if you need to do all the tests at once, this obviously won't work. Nevermind then.
$endgroup$
– user3294068
5 hours ago
$begingroup$
Oh, if you need to do all the tests at once, this obviously won't work. Nevermind then.
$endgroup$
– user3294068
5 hours ago
add a comment |
Thanks for contributing an answer to Puzzling Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fpuzzling.stackexchange.com%2fquestions%2f81737%2fwolves-and-sheep%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown

1
$begingroup$
This is close to a covering design (Lotto wheel) problem.
$endgroup$
– Arnaud Mortier
2 days ago
3
$begingroup$
First of all, does the government have enough funds to test 99 of the sheep? Because that would work, at a cost of $99,000. Congrats, you just saved 1,000 bucks.
$endgroup$
– user45266
yesterday
3
$begingroup$
Alternatively, you know the location of all 5 wolves. Take initiative and slaughter all 100. Now you have no more wolves, and food for a good while to come.
$endgroup$
– user45266
yesterday