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
Do square wave exist?
An adverb for when you're not exaggerating
Did MS DOS itself ever use blinking text?
How to answer "Have you ever been terminated?"
How to tell that you are a giant?
What is the meaning of the simile “quick as silk”?
Uniqueness of spanning tree on a grid.
Is there a kind of relay only consumes power when switching?
Circuit to "zoom in" on mV fluctuations of a DC signal?
Fantasy story; one type of magic grows in power with use, but the more powerful they are, they more they are drawn to travel to their source
When a candle burns, why does the top of wick glow if bottom of flame is hottest?
Do I really need to have a message in a novel to appeal to readers?
Why didn't Eitri join the fight?
When the Haste spell ends on a creature, do attackers have advantage against that creature?
Is it a good idea to use CNN to classify 1D signal?
How would a mousetrap for use in space work?
What causes the direction of lightning flashes?
Trademark violation for app?
What do you call a floor made of glass so you can see through the floor?
How to Make a Beautiful Stacked 3D Plot
How do pianists reach extremely loud dynamics?
2001: A Space Odyssey's use of the song "Daisy Bell" (Bicycle Built for Two); life imitates art or vice-versa?
Fundamental Solution of the Pell Equation
What is homebrew?
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
Apr 13 at 23:04
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
Apr 14 at 1:19
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
Apr 14 at 1:31
1
$begingroup$
@JyotishRobin, while I'm definitely not requesting to see your solution yet, I'm wondering: do you believe you know a solution involving 98-or-fewer tests? Do you believe you know the optimal solution? And if "yes" to either, a followup question: how confident are you in those beliefs? :)
$endgroup$
– Quuxplusone
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 Apr 14 at 16:01
Jyotish Robin
asked Apr 13 at 22:17
Jyotish RobinJyotish Robin
597113
597113
1
$begingroup$
This is close to a covering design (Lotto wheel) problem.
$endgroup$
– Arnaud Mortier
Apr 13 at 23:04
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
Apr 14 at 1:19
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
Apr 14 at 1:31
1
$begingroup$
@JyotishRobin, while I'm definitely not requesting to see your solution yet, I'm wondering: do you believe you know a solution involving 98-or-fewer tests? Do you believe you know the optimal solution? And if "yes" to either, a followup question: how confident are you in those beliefs? :)
$endgroup$
– Quuxplusone
yesterday
add a comment |
1
$begingroup$
This is close to a covering design (Lotto wheel) problem.
$endgroup$
– Arnaud Mortier
Apr 13 at 23:04
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
Apr 14 at 1:19
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
Apr 14 at 1:31
1
$begingroup$
@JyotishRobin, while I'm definitely not requesting to see your solution yet, I'm wondering: do you believe you know a solution involving 98-or-fewer tests? Do you believe you know the optimal solution? And if "yes" to either, a followup question: how confident are you in those beliefs? :)
$endgroup$
– Quuxplusone
yesterday
1
1
$begingroup$
This is close to a covering design (Lotto wheel) problem.
$endgroup$
– Arnaud Mortier
Apr 13 at 23:04
$begingroup$
This is close to a covering design (Lotto wheel) problem.
$endgroup$
– Arnaud Mortier
Apr 13 at 23:04
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
Apr 14 at 1:19
$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
Apr 14 at 1:19
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
Apr 14 at 1:31
$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
Apr 14 at 1:31
1
1
$begingroup$
@JyotishRobin, while I'm definitely not requesting to see your solution yet, I'm wondering: do you believe you know a solution involving 98-or-fewer tests? Do you believe you know the optimal solution? And if "yes" to either, a followup question: how confident are you in those beliefs? :)
$endgroup$
– Quuxplusone
yesterday
$begingroup$
@JyotishRobin, while I'm definitely not requesting to see your solution yet, I'm wondering: do you believe you know a solution involving 98-or-fewer tests? Do you believe you know the optimal solution? And if "yes" to either, a followup question: how confident are you in those beliefs? :)
$endgroup$
– Quuxplusone
yesterday
add a comment |
7 Answers
7
active
oldest
votes
$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,8 wolves among 9 sheep in fewer than 8 tests.
There is no way to find 3,4,5,6,7,8 wolves among 10 sheep in fewer than 9 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.
Also, it looks like we can use the exact same series of tests, plus a one-on-one test of the newcomer, to find 2 wolves among 9 sheep in only 7 tests.
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.)
MATH UPDATE:
I don't immediately see this sequence in the OEIS, which is surprising to me. Anyone spot a predictable pattern yet (other than the edges which are 0
and column 2 which is ⌈lg n⌉
, and I believe I've convinced myself that the right edge is just n-1
)? I've got my laptop working on the eleventh row as we speak.
k= 1 2 3 4 5 6 ...
0
n=1 0 0
n=2 0 1 0
n=3 0 2 2 0
n=4 0 2 3 3 0
n=5 0 3 4 4 4 0
n=6 0 3 5 5 5 5 0
n=7 0 3 6 6 6 6 6 0
n=8 0 3 6 7 7 7 7 7 0
n=9 0 4 7 8 8 8 8 8 8 0
n=10 0 4 7 9 9 9 9 9 9 9 0
$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
2 days ago
$begingroup$
This comes to mind @Amorydai
$endgroup$
– Andrew Savinykh
23 hours ago
add a comment |
$begingroup$
Perform
66
tests of nine sheep on all but one sheep according to the illustrated patterns:
The two important properties exhibited are
1. All but one sheep are tested six times.
2. No pair of sheep shares more than one test.
The claim is that given a set of test results there is at most one possible group of five wolves. Suppose instead that some set of test results could have been produced by two different groups of five wolves A and B. Then both groups have a sheep that the other group does not have.
By property 1, at least one of these two sheep was tested six times, say Shaun in group A. Group B must have at least one of five sheep in each of these tests. By the pigeonhole principle, at least one sheep in Group B shares more than one test with Shaun, contradicting property 2.
This establishes the claim. Because we know there are five wolves, this guarantees that we can determine them using the test results.
UPDATE: We can remove any single test T to improve the total by one. Say Shaun is in group A but not B, and Shirley in B but not A.
The argument above only fails if neither sheep was tested six times, i.e., each was either in T or untested. By property 1, one of them, say Shaun, was in T and still tested five times. Because Shirley was either in T or untested, Shirley cannot appear in any tests with Shaun by property 2. Then Shaun's remaining five tests must be accounted for by the remaining four sheep of group B, which fails as above due to the pigeonhole principle and property 2.
$endgroup$
$begingroup$
Seems convincing to me. Any idea how this could relate to OP's hint about binary representations?
$endgroup$
– Ergwun
12 hours ago
$begingroup$
@Ergwun No idea.
$endgroup$
– noedne
12 hours ago
$begingroup$
Sounds convincing! I was initially very confused by the sentence "Then there are at least two sheep that appear in one group but not the other." How does that conclusion follow from the preceding sentence? ...But it doesn't. It's a lemma which is then proved by the subsequent spoilertext. ...I think. Actually, I've confused myself again.
$endgroup$
– Quuxplusone
10 hours ago
$begingroup$
Suppose your method failed to distinguish actual-wolf-grouping (a,b,c,d,e) from incorrect-wolf-grouping (a,b,c,d,f) — that is, sheep f is innocent — so, each of f's tests must have contained one of the actual wolves (a,b,c,d,e) in order for the frame to stick — which is impossible because f was tested 6 times and there's only 5 of (a,b,c,d,e). OR ELSE, f must be the one untested sheep! How does your logic rule out that possibility?
$endgroup$
– Quuxplusone
10 hours ago
$begingroup$
@Quuxplusone If you take two different groups of five wolves, then each must contain at least one wolf that the other does not contain. In your example, e and f are the two "sheep that appear in one group but not the other." So you may not be able to take one of them (f), but you can still take the other (e).
$endgroup$
– noedne
2 hours ago
|
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
$endgroup$
$begingroup$
This matches what I was thinking. In one "iteration" oflg 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 oflg 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 inK lg N
tests. Your answer of 35 is not terribly far off the mathematically theoretical minimum ofceil(lg (100 choose 5)) =
27 tests.
$endgroup$
– Quuxplusone
Apr 14 at 14:55
1
$begingroup$
Why do you think this works? Do wolves in positions 2, 60, and 69 make all tests pass?
$endgroup$
– noedne
Apr 14 at 15:39
$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
Apr 14 at 15:56
$begingroup$
@JyotishRobin: Aha, that's almost a complete solution posted as a hint, isn't it?
$endgroup$
– Quuxplusone
Apr 14 at 16:16
3
$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
Apr 14 at 16:25
|
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
$endgroup$
$begingroup$
+1! Are the diagonals required?
$endgroup$
– user45266
Apr 14 at 5:12
$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
Apr 14 at 5:15
$begingroup$
Oops, that's a spoiler, probably should learn that rot13 thing I see everywhere on this site
$endgroup$
– Andrew Williamson
Apr 14 at 5:16
$begingroup$
It would be better if you could add the additional info to the answer itself instead of the comment.
$endgroup$
– Jyotish Robin
Apr 14 at 5:32
2
$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
Apr 14 at 6:52
|
show 6 more comments
$begingroup$
My dear king,
I can do it in 99 tests:
I will take a blood sample from 99 randomly choosen 'sheep' and send those 99 blood samples to the doctors.
Then we will wait for the result.
If the results shows 5 wolves, you got them.
Else:
If the results only show you 4 wolves, the 5th wolf is the untested animal.
Sincerely,
your most loyal servant H.Idden (not a wolf)
$endgroup$
add a comment |
$begingroup$
If the results are available after all the tests are done, then I think can do it in minimum of 60 tests with 100% accuracy.
Explanation
I would number everyone from 1-100 and then arrange them in a hypothetical 5x5x4 (Row x Column x Depth) 3-D grid like this one shown here.
[Check out the 3-d grid here]
Then I would make 60 pools total. Three such pools are shown in the image - one for R3 across all Columns (C), one for C3 across all Depths (D) and another for D4 across all Rows (R). The intersection of three pools for each wolf will confirm its location in the grid, and can be identified using the number assigned at that position.
New contributor
$endgroup$
2
$begingroup$
That’s an interesting approach. First of all 65 tests are possible, not 60. But more than that, unfortunately the test can give ambiguous results. This happens when three wolves make an intersection with no wolf there. For example, consider four wolves at (R3, C1, D1); (R1, C3, D1); (R3, C1, D4); (R1, C3, D4). If the fifth wolf is at (R3, C3, D1) or (R3, C3, D4) you will never know which one, because these combinations give exactly the same results, so the test fails.
$endgroup$
– Amorydai
yesterday
$begingroup$
Ah, that is correct about the ambiguous wolf. But how 65 tests and not 60?
$endgroup$
– nsinghs
yesterday
1
$begingroup$
there are 25 tests that go across the depths: R1C1 to R5C5. The other pools have 20 each, for a total of 65.
$endgroup$
– Amorydai
yesterday
$begingroup$
Ah shoot, I miscalculated. Thanks.
$endgroup$
– nsinghs
yesterday
add a comment |
$begingroup$
I don't have a solution, but I might have an approach.
Define 3 binary matrices:
$C$ is a list of all the combinations of 5 out of 100. So it has 100 columns, 75,287,520 rows and each row has 5 trues with the rest false.
$M$ is the measurement matrix which tells you what to measure on a given measurement. Each column tells you which sheep to measure in that test. It has 100 rows and $m$ columns (one for each measurement).
$R$ is the results matrix. It has 75,287,520 rows (one for each possible result) and $m$ columns (one for each test).
Then $Ccdot M = R$. Here we are doing normal matrix multiplication except that instead of multiplying the individual elements we are using the "and" operation, and instead of adding the pairs we are using the "or" operation. In other words:
beginequationR_i,j = cup_k=1^100(c_i,kcap m_k,j)endequation
where the $cap$ refers to the "logical and" operation and the $cup$ is the "logical or" operation.
What we want is to find a matrix $M$ such that each row of $R$ is unique and $m$ is as small as possible.
Now we can define $R$ to be simply the binary numbers in any order which would make $m=27$.
Then we'd have to find a left inverse of $C$ (using the same matrix operations as define above).
Suppose we can find $C^-1_mathrmleft$, a left inverse of $C$.
Then $M$ = $C^-1_mathrmleftcdot R$. This would be something like the transpose of @Quuxplusone's matrix for 6 sheep and 2 wolves.
Now, the inverse shoud be $C^-1_mathrmleft=(C^Tcdot C)^-1cdot C^T$.
C is quite a big matrix to inverse and I'm not sure what python would do with binary matrices. But, in theory, this is an approach that could work, assuming $C$ has a left inverse.
Note, that if it does have an inverse, then it can be done in 27 measurements. It would be interesting to try get this working for some of the simpler cases.
$endgroup$
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
7 Answers
7
active
oldest
votes
7 Answers
7
active
oldest
votes
active
oldest
votes
active
oldest
votes
$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,8 wolves among 9 sheep in fewer than 8 tests.
There is no way to find 3,4,5,6,7,8 wolves among 10 sheep in fewer than 9 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.
Also, it looks like we can use the exact same series of tests, plus a one-on-one test of the newcomer, to find 2 wolves among 9 sheep in only 7 tests.
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.)
MATH UPDATE:
I don't immediately see this sequence in the OEIS, which is surprising to me. Anyone spot a predictable pattern yet (other than the edges which are 0
and column 2 which is ⌈lg n⌉
, and I believe I've convinced myself that the right edge is just n-1
)? I've got my laptop working on the eleventh row as we speak.
k= 1 2 3 4 5 6 ...
0
n=1 0 0
n=2 0 1 0
n=3 0 2 2 0
n=4 0 2 3 3 0
n=5 0 3 4 4 4 0
n=6 0 3 5 5 5 5 0
n=7 0 3 6 6 6 6 6 0
n=8 0 3 6 7 7 7 7 7 0
n=9 0 4 7 8 8 8 8 8 8 0
n=10 0 4 7 9 9 9 9 9 9 9 0
$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
2 days ago
$begingroup$
This comes to mind @Amorydai
$endgroup$
– Andrew Savinykh
23 hours 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,8 wolves among 9 sheep in fewer than 8 tests.
There is no way to find 3,4,5,6,7,8 wolves among 10 sheep in fewer than 9 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.
Also, it looks like we can use the exact same series of tests, plus a one-on-one test of the newcomer, to find 2 wolves among 9 sheep in only 7 tests.
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.)
MATH UPDATE:
I don't immediately see this sequence in the OEIS, which is surprising to me. Anyone spot a predictable pattern yet (other than the edges which are 0
and column 2 which is ⌈lg n⌉
, and I believe I've convinced myself that the right edge is just n-1
)? I've got my laptop working on the eleventh row as we speak.
k= 1 2 3 4 5 6 ...
0
n=1 0 0
n=2 0 1 0
n=3 0 2 2 0
n=4 0 2 3 3 0
n=5 0 3 4 4 4 0
n=6 0 3 5 5 5 5 0
n=7 0 3 6 6 6 6 6 0
n=8 0 3 6 7 7 7 7 7 0
n=9 0 4 7 8 8 8 8 8 8 0
n=10 0 4 7 9 9 9 9 9 9 9 0
$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
2 days ago
$begingroup$
This comes to mind @Amorydai
$endgroup$
– Andrew Savinykh
23 hours 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,8 wolves among 9 sheep in fewer than 8 tests.
There is no way to find 3,4,5,6,7,8 wolves among 10 sheep in fewer than 9 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.
Also, it looks like we can use the exact same series of tests, plus a one-on-one test of the newcomer, to find 2 wolves among 9 sheep in only 7 tests.
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.)
MATH UPDATE:
I don't immediately see this sequence in the OEIS, which is surprising to me. Anyone spot a predictable pattern yet (other than the edges which are 0
and column 2 which is ⌈lg n⌉
, and I believe I've convinced myself that the right edge is just n-1
)? I've got my laptop working on the eleventh row as we speak.
k= 1 2 3 4 5 6 ...
0
n=1 0 0
n=2 0 1 0
n=3 0 2 2 0
n=4 0 2 3 3 0
n=5 0 3 4 4 4 0
n=6 0 3 5 5 5 5 0
n=7 0 3 6 6 6 6 6 0
n=8 0 3 6 7 7 7 7 7 0
n=9 0 4 7 8 8 8 8 8 8 0
n=10 0 4 7 9 9 9 9 9 9 9 0
$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,8 wolves among 9 sheep in fewer than 8 tests.
There is no way to find 3,4,5,6,7,8 wolves among 10 sheep in fewer than 9 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.
Also, it looks like we can use the exact same series of tests, plus a one-on-one test of the newcomer, to find 2 wolves among 9 sheep in only 7 tests.
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.)
MATH UPDATE:
I don't immediately see this sequence in the OEIS, which is surprising to me. Anyone spot a predictable pattern yet (other than the edges which are 0
and column 2 which is ⌈lg n⌉
, and I believe I've convinced myself that the right edge is just n-1
)? I've got my laptop working on the eleventh row as we speak.
k= 1 2 3 4 5 6 ...
0
n=1 0 0
n=2 0 1 0
n=3 0 2 2 0
n=4 0 2 3 3 0
n=5 0 3 4 4 4 0
n=6 0 3 5 5 5 5 0
n=7 0 3 6 6 6 6 6 0
n=8 0 3 6 7 7 7 7 7 0
n=9 0 4 7 8 8 8 8 8 8 0
n=10 0 4 7 9 9 9 9 9 9 9 0
edited yesterday
answered 2 days ago
QuuxplusoneQuuxplusone
472213
472213
$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
2 days ago
$begingroup$
This comes to mind @Amorydai
$endgroup$
– Andrew Savinykh
23 hours 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
2 days ago
$begingroup$
This comes to mind @Amorydai
$endgroup$
– Andrew Savinykh
23 hours 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
2 days 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
2 days ago
$begingroup$
This comes to mind @Amorydai
$endgroup$
– Andrew Savinykh
23 hours ago
$begingroup$
This comes to mind @Amorydai
$endgroup$
– Andrew Savinykh
23 hours ago
add a comment |
$begingroup$
Perform
66
tests of nine sheep on all but one sheep according to the illustrated patterns:
The two important properties exhibited are
1. All but one sheep are tested six times.
2. No pair of sheep shares more than one test.
The claim is that given a set of test results there is at most one possible group of five wolves. Suppose instead that some set of test results could have been produced by two different groups of five wolves A and B. Then both groups have a sheep that the other group does not have.
By property 1, at least one of these two sheep was tested six times, say Shaun in group A. Group B must have at least one of five sheep in each of these tests. By the pigeonhole principle, at least one sheep in Group B shares more than one test with Shaun, contradicting property 2.
This establishes the claim. Because we know there are five wolves, this guarantees that we can determine them using the test results.
UPDATE: We can remove any single test T to improve the total by one. Say Shaun is in group A but not B, and Shirley in B but not A.
The argument above only fails if neither sheep was tested six times, i.e., each was either in T or untested. By property 1, one of them, say Shaun, was in T and still tested five times. Because Shirley was either in T or untested, Shirley cannot appear in any tests with Shaun by property 2. Then Shaun's remaining five tests must be accounted for by the remaining four sheep of group B, which fails as above due to the pigeonhole principle and property 2.
$endgroup$
$begingroup$
Seems convincing to me. Any idea how this could relate to OP's hint about binary representations?
$endgroup$
– Ergwun
12 hours ago
$begingroup$
@Ergwun No idea.
$endgroup$
– noedne
12 hours ago
$begingroup$
Sounds convincing! I was initially very confused by the sentence "Then there are at least two sheep that appear in one group but not the other." How does that conclusion follow from the preceding sentence? ...But it doesn't. It's a lemma which is then proved by the subsequent spoilertext. ...I think. Actually, I've confused myself again.
$endgroup$
– Quuxplusone
10 hours ago
$begingroup$
Suppose your method failed to distinguish actual-wolf-grouping (a,b,c,d,e) from incorrect-wolf-grouping (a,b,c,d,f) — that is, sheep f is innocent — so, each of f's tests must have contained one of the actual wolves (a,b,c,d,e) in order for the frame to stick — which is impossible because f was tested 6 times and there's only 5 of (a,b,c,d,e). OR ELSE, f must be the one untested sheep! How does your logic rule out that possibility?
$endgroup$
– Quuxplusone
10 hours ago
$begingroup$
@Quuxplusone If you take two different groups of five wolves, then each must contain at least one wolf that the other does not contain. In your example, e and f are the two "sheep that appear in one group but not the other." So you may not be able to take one of them (f), but you can still take the other (e).
$endgroup$
– noedne
2 hours ago
|
show 2 more comments
$begingroup$
Perform
66
tests of nine sheep on all but one sheep according to the illustrated patterns:
The two important properties exhibited are
1. All but one sheep are tested six times.
2. No pair of sheep shares more than one test.
The claim is that given a set of test results there is at most one possible group of five wolves. Suppose instead that some set of test results could have been produced by two different groups of five wolves A and B. Then both groups have a sheep that the other group does not have.
By property 1, at least one of these two sheep was tested six times, say Shaun in group A. Group B must have at least one of five sheep in each of these tests. By the pigeonhole principle, at least one sheep in Group B shares more than one test with Shaun, contradicting property 2.
This establishes the claim. Because we know there are five wolves, this guarantees that we can determine them using the test results.
UPDATE: We can remove any single test T to improve the total by one. Say Shaun is in group A but not B, and Shirley in B but not A.
The argument above only fails if neither sheep was tested six times, i.e., each was either in T or untested. By property 1, one of them, say Shaun, was in T and still tested five times. Because Shirley was either in T or untested, Shirley cannot appear in any tests with Shaun by property 2. Then Shaun's remaining five tests must be accounted for by the remaining four sheep of group B, which fails as above due to the pigeonhole principle and property 2.
$endgroup$
$begingroup$
Seems convincing to me. Any idea how this could relate to OP's hint about binary representations?
$endgroup$
– Ergwun
12 hours ago
$begingroup$
@Ergwun No idea.
$endgroup$
– noedne
12 hours ago
$begingroup$
Sounds convincing! I was initially very confused by the sentence "Then there are at least two sheep that appear in one group but not the other." How does that conclusion follow from the preceding sentence? ...But it doesn't. It's a lemma which is then proved by the subsequent spoilertext. ...I think. Actually, I've confused myself again.
$endgroup$
– Quuxplusone
10 hours ago
$begingroup$
Suppose your method failed to distinguish actual-wolf-grouping (a,b,c,d,e) from incorrect-wolf-grouping (a,b,c,d,f) — that is, sheep f is innocent — so, each of f's tests must have contained one of the actual wolves (a,b,c,d,e) in order for the frame to stick — which is impossible because f was tested 6 times and there's only 5 of (a,b,c,d,e). OR ELSE, f must be the one untested sheep! How does your logic rule out that possibility?
$endgroup$
– Quuxplusone
10 hours ago
$begingroup$
@Quuxplusone If you take two different groups of five wolves, then each must contain at least one wolf that the other does not contain. In your example, e and f are the two "sheep that appear in one group but not the other." So you may not be able to take one of them (f), but you can still take the other (e).
$endgroup$
– noedne
2 hours ago
|
show 2 more comments
$begingroup$
Perform
66
tests of nine sheep on all but one sheep according to the illustrated patterns:
The two important properties exhibited are
1. All but one sheep are tested six times.
2. No pair of sheep shares more than one test.
The claim is that given a set of test results there is at most one possible group of five wolves. Suppose instead that some set of test results could have been produced by two different groups of five wolves A and B. Then both groups have a sheep that the other group does not have.
By property 1, at least one of these two sheep was tested six times, say Shaun in group A. Group B must have at least one of five sheep in each of these tests. By the pigeonhole principle, at least one sheep in Group B shares more than one test with Shaun, contradicting property 2.
This establishes the claim. Because we know there are five wolves, this guarantees that we can determine them using the test results.
UPDATE: We can remove any single test T to improve the total by one. Say Shaun is in group A but not B, and Shirley in B but not A.
The argument above only fails if neither sheep was tested six times, i.e., each was either in T or untested. By property 1, one of them, say Shaun, was in T and still tested five times. Because Shirley was either in T or untested, Shirley cannot appear in any tests with Shaun by property 2. Then Shaun's remaining five tests must be accounted for by the remaining four sheep of group B, which fails as above due to the pigeonhole principle and property 2.
$endgroup$
Perform
66
tests of nine sheep on all but one sheep according to the illustrated patterns:
The two important properties exhibited are
1. All but one sheep are tested six times.
2. No pair of sheep shares more than one test.
The claim is that given a set of test results there is at most one possible group of five wolves. Suppose instead that some set of test results could have been produced by two different groups of five wolves A and B. Then both groups have a sheep that the other group does not have.
By property 1, at least one of these two sheep was tested six times, say Shaun in group A. Group B must have at least one of five sheep in each of these tests. By the pigeonhole principle, at least one sheep in Group B shares more than one test with Shaun, contradicting property 2.
This establishes the claim. Because we know there are five wolves, this guarantees that we can determine them using the test results.
UPDATE: We can remove any single test T to improve the total by one. Say Shaun is in group A but not B, and Shirley in B but not A.
The argument above only fails if neither sheep was tested six times, i.e., each was either in T or untested. By property 1, one of them, say Shaun, was in T and still tested five times. Because Shirley was either in T or untested, Shirley cannot appear in any tests with Shaun by property 2. Then Shaun's remaining five tests must be accounted for by the remaining four sheep of group B, which fails as above due to the pigeonhole principle and property 2.
edited 1 hour ago
answered 16 hours ago
noednenoedne
9,35512566
9,35512566
$begingroup$
Seems convincing to me. Any idea how this could relate to OP's hint about binary representations?
$endgroup$
– Ergwun
12 hours ago
$begingroup$
@Ergwun No idea.
$endgroup$
– noedne
12 hours ago
$begingroup$
Sounds convincing! I was initially very confused by the sentence "Then there are at least two sheep that appear in one group but not the other." How does that conclusion follow from the preceding sentence? ...But it doesn't. It's a lemma which is then proved by the subsequent spoilertext. ...I think. Actually, I've confused myself again.
$endgroup$
– Quuxplusone
10 hours ago
$begingroup$
Suppose your method failed to distinguish actual-wolf-grouping (a,b,c,d,e) from incorrect-wolf-grouping (a,b,c,d,f) — that is, sheep f is innocent — so, each of f's tests must have contained one of the actual wolves (a,b,c,d,e) in order for the frame to stick — which is impossible because f was tested 6 times and there's only 5 of (a,b,c,d,e). OR ELSE, f must be the one untested sheep! How does your logic rule out that possibility?
$endgroup$
– Quuxplusone
10 hours ago
$begingroup$
@Quuxplusone If you take two different groups of five wolves, then each must contain at least one wolf that the other does not contain. In your example, e and f are the two "sheep that appear in one group but not the other." So you may not be able to take one of them (f), but you can still take the other (e).
$endgroup$
– noedne
2 hours ago
|
show 2 more comments
$begingroup$
Seems convincing to me. Any idea how this could relate to OP's hint about binary representations?
$endgroup$
– Ergwun
12 hours ago
$begingroup$
@Ergwun No idea.
$endgroup$
– noedne
12 hours ago
$begingroup$
Sounds convincing! I was initially very confused by the sentence "Then there are at least two sheep that appear in one group but not the other." How does that conclusion follow from the preceding sentence? ...But it doesn't. It's a lemma which is then proved by the subsequent spoilertext. ...I think. Actually, I've confused myself again.
$endgroup$
– Quuxplusone
10 hours ago
$begingroup$
Suppose your method failed to distinguish actual-wolf-grouping (a,b,c,d,e) from incorrect-wolf-grouping (a,b,c,d,f) — that is, sheep f is innocent — so, each of f's tests must have contained one of the actual wolves (a,b,c,d,e) in order for the frame to stick — which is impossible because f was tested 6 times and there's only 5 of (a,b,c,d,e). OR ELSE, f must be the one untested sheep! How does your logic rule out that possibility?
$endgroup$
– Quuxplusone
10 hours ago
$begingroup$
@Quuxplusone If you take two different groups of five wolves, then each must contain at least one wolf that the other does not contain. In your example, e and f are the two "sheep that appear in one group but not the other." So you may not be able to take one of them (f), but you can still take the other (e).
$endgroup$
– noedne
2 hours ago
$begingroup$
Seems convincing to me. Any idea how this could relate to OP's hint about binary representations?
$endgroup$
– Ergwun
12 hours ago
$begingroup$
Seems convincing to me. Any idea how this could relate to OP's hint about binary representations?
$endgroup$
– Ergwun
12 hours ago
$begingroup$
@Ergwun No idea.
$endgroup$
– noedne
12 hours ago
$begingroup$
@Ergwun No idea.
$endgroup$
– noedne
12 hours ago
$begingroup$
Sounds convincing! I was initially very confused by the sentence "Then there are at least two sheep that appear in one group but not the other." How does that conclusion follow from the preceding sentence? ...But it doesn't. It's a lemma which is then proved by the subsequent spoilertext. ...I think. Actually, I've confused myself again.
$endgroup$
– Quuxplusone
10 hours ago
$begingroup$
Sounds convincing! I was initially very confused by the sentence "Then there are at least two sheep that appear in one group but not the other." How does that conclusion follow from the preceding sentence? ...But it doesn't. It's a lemma which is then proved by the subsequent spoilertext. ...I think. Actually, I've confused myself again.
$endgroup$
– Quuxplusone
10 hours ago
$begingroup$
Suppose your method failed to distinguish actual-wolf-grouping (a,b,c,d,e) from incorrect-wolf-grouping (a,b,c,d,f) — that is, sheep f is innocent — so, each of f's tests must have contained one of the actual wolves (a,b,c,d,e) in order for the frame to stick — which is impossible because f was tested 6 times and there's only 5 of (a,b,c,d,e). OR ELSE, f must be the one untested sheep! How does your logic rule out that possibility?
$endgroup$
– Quuxplusone
10 hours ago
$begingroup$
Suppose your method failed to distinguish actual-wolf-grouping (a,b,c,d,e) from incorrect-wolf-grouping (a,b,c,d,f) — that is, sheep f is innocent — so, each of f's tests must have contained one of the actual wolves (a,b,c,d,e) in order for the frame to stick — which is impossible because f was tested 6 times and there's only 5 of (a,b,c,d,e). OR ELSE, f must be the one untested sheep! How does your logic rule out that possibility?
$endgroup$
– Quuxplusone
10 hours ago
$begingroup$
@Quuxplusone If you take two different groups of five wolves, then each must contain at least one wolf that the other does not contain. In your example, e and f are the two "sheep that appear in one group but not the other." So you may not be able to take one of them (f), but you can still take the other (e).
$endgroup$
– noedne
2 hours ago
$begingroup$
@Quuxplusone If you take two different groups of five wolves, then each must contain at least one wolf that the other does not contain. In your example, e and f are the two "sheep that appear in one group but not the other." So you may not be able to take one of them (f), but you can still take the other (e).
$endgroup$
– noedne
2 hours ago
|
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
$endgroup$
$begingroup$
This matches what I was thinking. In one "iteration" oflg 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 oflg 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 inK lg N
tests. Your answer of 35 is not terribly far off the mathematically theoretical minimum ofceil(lg (100 choose 5)) =
27 tests.
$endgroup$
– Quuxplusone
Apr 14 at 14:55
1
$begingroup$
Why do you think this works? Do wolves in positions 2, 60, and 69 make all tests pass?
$endgroup$
– noedne
Apr 14 at 15:39
$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
Apr 14 at 15:56
$begingroup$
@JyotishRobin: Aha, that's almost a complete solution posted as a hint, isn't it?
$endgroup$
– Quuxplusone
Apr 14 at 16:16
3
$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
Apr 14 at 16:25
|
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
$endgroup$
$begingroup$
This matches what I was thinking. In one "iteration" oflg 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 oflg 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 inK lg N
tests. Your answer of 35 is not terribly far off the mathematically theoretical minimum ofceil(lg (100 choose 5)) =
27 tests.
$endgroup$
– Quuxplusone
Apr 14 at 14:55
1
$begingroup$
Why do you think this works? Do wolves in positions 2, 60, and 69 make all tests pass?
$endgroup$
– noedne
Apr 14 at 15:39
$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
Apr 14 at 15:56
$begingroup$
@JyotishRobin: Aha, that's almost a complete solution posted as a hint, isn't it?
$endgroup$
– Quuxplusone
Apr 14 at 16:16
3
$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
Apr 14 at 16:25
|
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
$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
New contributor
answered Apr 14 at 9:58
Andrew WilliamsonAndrew Williamson
1673
1673
New contributor
New contributor
$begingroup$
This matches what I was thinking. In one "iteration" oflg 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 oflg 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 inK lg N
tests. Your answer of 35 is not terribly far off the mathematically theoretical minimum ofceil(lg (100 choose 5)) =
27 tests.
$endgroup$
– Quuxplusone
Apr 14 at 14:55
1
$begingroup$
Why do you think this works? Do wolves in positions 2, 60, and 69 make all tests pass?
$endgroup$
– noedne
Apr 14 at 15:39
$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
Apr 14 at 15:56
$begingroup$
@JyotishRobin: Aha, that's almost a complete solution posted as a hint, isn't it?
$endgroup$
– Quuxplusone
Apr 14 at 16:16
3
$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
Apr 14 at 16:25
|
show 2 more comments
$begingroup$
This matches what I was thinking. In one "iteration" oflg 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 oflg 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 inK lg N
tests. Your answer of 35 is not terribly far off the mathematically theoretical minimum ofceil(lg (100 choose 5)) =
27 tests.
$endgroup$
– Quuxplusone
Apr 14 at 14:55
1
$begingroup$
Why do you think this works? Do wolves in positions 2, 60, and 69 make all tests pass?
$endgroup$
– noedne
Apr 14 at 15:39
$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
Apr 14 at 15:56
$begingroup$
@JyotishRobin: Aha, that's almost a complete solution posted as a hint, isn't it?
$endgroup$
– Quuxplusone
Apr 14 at 16:16
3
$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
Apr 14 at 16:25
$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
Apr 14 at 14:55
$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
Apr 14 at 14:55
1
1
$begingroup$
Why do you think this works? Do wolves in positions 2, 60, and 69 make all tests pass?
$endgroup$
– noedne
Apr 14 at 15:39
$begingroup$
Why do you think this works? Do wolves in positions 2, 60, and 69 make all tests pass?
$endgroup$
– noedne
Apr 14 at 15:39
$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
Apr 14 at 15:56
$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
Apr 14 at 15:56
$begingroup$
@JyotishRobin: Aha, that's almost a complete solution posted as a hint, isn't it?
$endgroup$
– Quuxplusone
Apr 14 at 16:16
$begingroup$
@JyotishRobin: Aha, that's almost a complete solution posted as a hint, isn't it?
$endgroup$
– Quuxplusone
Apr 14 at 16:16
3
3
$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
Apr 14 at 16:25
$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
Apr 14 at 16:25
|
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
$endgroup$
$begingroup$
+1! Are the diagonals required?
$endgroup$
– user45266
Apr 14 at 5:12
$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
Apr 14 at 5:15
$begingroup$
Oops, that's a spoiler, probably should learn that rot13 thing I see everywhere on this site
$endgroup$
– Andrew Williamson
Apr 14 at 5:16
$begingroup$
It would be better if you could add the additional info to the answer itself instead of the comment.
$endgroup$
– Jyotish Robin
Apr 14 at 5:32
2
$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
Apr 14 at 6:52
|
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
$endgroup$
$begingroup$
+1! Are the diagonals required?
$endgroup$
– user45266
Apr 14 at 5:12
$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
Apr 14 at 5:15
$begingroup$
Oops, that's a spoiler, probably should learn that rot13 thing I see everywhere on this site
$endgroup$
– Andrew Williamson
Apr 14 at 5:16
$begingroup$
It would be better if you could add the additional info to the answer itself instead of the comment.
$endgroup$
– Jyotish Robin
Apr 14 at 5:32
2
$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
Apr 14 at 6:52
|
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
$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
edited Apr 14 at 20:36
New contributor
answered Apr 14 at 5:09
Andrew WilliamsonAndrew Williamson
1673
1673
New contributor
New contributor
$begingroup$
+1! Are the diagonals required?
$endgroup$
– user45266
Apr 14 at 5:12
$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
Apr 14 at 5:15
$begingroup$
Oops, that's a spoiler, probably should learn that rot13 thing I see everywhere on this site
$endgroup$
– Andrew Williamson
Apr 14 at 5:16
$begingroup$
It would be better if you could add the additional info to the answer itself instead of the comment.
$endgroup$
– Jyotish Robin
Apr 14 at 5:32
2
$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
Apr 14 at 6:52
|
show 6 more comments
$begingroup$
+1! Are the diagonals required?
$endgroup$
– user45266
Apr 14 at 5:12
$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
Apr 14 at 5:15
$begingroup$
Oops, that's a spoiler, probably should learn that rot13 thing I see everywhere on this site
$endgroup$
– Andrew Williamson
Apr 14 at 5:16
$begingroup$
It would be better if you could add the additional info to the answer itself instead of the comment.
$endgroup$
– Jyotish Robin
Apr 14 at 5:32
2
$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
Apr 14 at 6:52
$begingroup$
+1! Are the diagonals required?
$endgroup$
– user45266
Apr 14 at 5:12
$begingroup$
+1! Are the diagonals required?
$endgroup$
– user45266
Apr 14 at 5:12
$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
Apr 14 at 5:15
$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
Apr 14 at 5:15
$begingroup$
Oops, that's a spoiler, probably should learn that rot13 thing I see everywhere on this site
$endgroup$
– Andrew Williamson
Apr 14 at 5:16
$begingroup$
Oops, that's a spoiler, probably should learn that rot13 thing I see everywhere on this site
$endgroup$
– Andrew Williamson
Apr 14 at 5:16
$begingroup$
It would be better if you could add the additional info to the answer itself instead of the comment.
$endgroup$
– Jyotish Robin
Apr 14 at 5:32
$begingroup$
It would be better if you could add the additional info to the answer itself instead of the comment.
$endgroup$
– Jyotish Robin
Apr 14 at 5:32
2
2
$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
Apr 14 at 6:52
$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
Apr 14 at 6:52
|
show 6 more comments
$begingroup$
My dear king,
I can do it in 99 tests:
I will take a blood sample from 99 randomly choosen 'sheep' and send those 99 blood samples to the doctors.
Then we will wait for the result.
If the results shows 5 wolves, you got them.
Else:
If the results only show you 4 wolves, the 5th wolf is the untested animal.
Sincerely,
your most loyal servant H.Idden (not a wolf)
$endgroup$
add a comment |
$begingroup$
My dear king,
I can do it in 99 tests:
I will take a blood sample from 99 randomly choosen 'sheep' and send those 99 blood samples to the doctors.
Then we will wait for the result.
If the results shows 5 wolves, you got them.
Else:
If the results only show you 4 wolves, the 5th wolf is the untested animal.
Sincerely,
your most loyal servant H.Idden (not a wolf)
$endgroup$
add a comment |
$begingroup$
My dear king,
I can do it in 99 tests:
I will take a blood sample from 99 randomly choosen 'sheep' and send those 99 blood samples to the doctors.
Then we will wait for the result.
If the results shows 5 wolves, you got them.
Else:
If the results only show you 4 wolves, the 5th wolf is the untested animal.
Sincerely,
your most loyal servant H.Idden (not a wolf)
$endgroup$
My dear king,
I can do it in 99 tests:
I will take a blood sample from 99 randomly choosen 'sheep' and send those 99 blood samples to the doctors.
Then we will wait for the result.
If the results shows 5 wolves, you got them.
Else:
If the results only show you 4 wolves, the 5th wolf is the untested animal.
Sincerely,
your most loyal servant H.Idden (not a wolf)
edited yesterday
answered yesterday
H. IddenH. Idden
1465
1465
add a comment |
add a comment |
$begingroup$
If the results are available after all the tests are done, then I think can do it in minimum of 60 tests with 100% accuracy.
Explanation
I would number everyone from 1-100 and then arrange them in a hypothetical 5x5x4 (Row x Column x Depth) 3-D grid like this one shown here.
[Check out the 3-d grid here]
Then I would make 60 pools total. Three such pools are shown in the image - one for R3 across all Columns (C), one for C3 across all Depths (D) and another for D4 across all Rows (R). The intersection of three pools for each wolf will confirm its location in the grid, and can be identified using the number assigned at that position.
New contributor
$endgroup$
2
$begingroup$
That’s an interesting approach. First of all 65 tests are possible, not 60. But more than that, unfortunately the test can give ambiguous results. This happens when three wolves make an intersection with no wolf there. For example, consider four wolves at (R3, C1, D1); (R1, C3, D1); (R3, C1, D4); (R1, C3, D4). If the fifth wolf is at (R3, C3, D1) or (R3, C3, D4) you will never know which one, because these combinations give exactly the same results, so the test fails.
$endgroup$
– Amorydai
yesterday
$begingroup$
Ah, that is correct about the ambiguous wolf. But how 65 tests and not 60?
$endgroup$
– nsinghs
yesterday
1
$begingroup$
there are 25 tests that go across the depths: R1C1 to R5C5. The other pools have 20 each, for a total of 65.
$endgroup$
– Amorydai
yesterday
$begingroup$
Ah shoot, I miscalculated. Thanks.
$endgroup$
– nsinghs
yesterday
add a comment |
$begingroup$
If the results are available after all the tests are done, then I think can do it in minimum of 60 tests with 100% accuracy.
Explanation
I would number everyone from 1-100 and then arrange them in a hypothetical 5x5x4 (Row x Column x Depth) 3-D grid like this one shown here.
[Check out the 3-d grid here]
Then I would make 60 pools total. Three such pools are shown in the image - one for R3 across all Columns (C), one for C3 across all Depths (D) and another for D4 across all Rows (R). The intersection of three pools for each wolf will confirm its location in the grid, and can be identified using the number assigned at that position.
New contributor
$endgroup$
2
$begingroup$
That’s an interesting approach. First of all 65 tests are possible, not 60. But more than that, unfortunately the test can give ambiguous results. This happens when three wolves make an intersection with no wolf there. For example, consider four wolves at (R3, C1, D1); (R1, C3, D1); (R3, C1, D4); (R1, C3, D4). If the fifth wolf is at (R3, C3, D1) or (R3, C3, D4) you will never know which one, because these combinations give exactly the same results, so the test fails.
$endgroup$
– Amorydai
yesterday
$begingroup$
Ah, that is correct about the ambiguous wolf. But how 65 tests and not 60?
$endgroup$
– nsinghs
yesterday
1
$begingroup$
there are 25 tests that go across the depths: R1C1 to R5C5. The other pools have 20 each, for a total of 65.
$endgroup$
– Amorydai
yesterday
$begingroup$
Ah shoot, I miscalculated. Thanks.
$endgroup$
– nsinghs
yesterday
add a comment |
$begingroup$
If the results are available after all the tests are done, then I think can do it in minimum of 60 tests with 100% accuracy.
Explanation
I would number everyone from 1-100 and then arrange them in a hypothetical 5x5x4 (Row x Column x Depth) 3-D grid like this one shown here.
[Check out the 3-d grid here]
Then I would make 60 pools total. Three such pools are shown in the image - one for R3 across all Columns (C), one for C3 across all Depths (D) and another for D4 across all Rows (R). The intersection of three pools for each wolf will confirm its location in the grid, and can be identified using the number assigned at that position.
New contributor
$endgroup$
If the results are available after all the tests are done, then I think can do it in minimum of 60 tests with 100% accuracy.
Explanation
I would number everyone from 1-100 and then arrange them in a hypothetical 5x5x4 (Row x Column x Depth) 3-D grid like this one shown here.
[Check out the 3-d grid here]
Then I would make 60 pools total. Three such pools are shown in the image - one for R3 across all Columns (C), one for C3 across all Depths (D) and another for D4 across all Rows (R). The intersection of three pools for each wolf will confirm its location in the grid, and can be identified using the number assigned at that position.
New contributor
edited yesterday
New contributor
answered yesterday
nsinghsnsinghs
1013
1013
New contributor
New contributor
2
$begingroup$
That’s an interesting approach. First of all 65 tests are possible, not 60. But more than that, unfortunately the test can give ambiguous results. This happens when three wolves make an intersection with no wolf there. For example, consider four wolves at (R3, C1, D1); (R1, C3, D1); (R3, C1, D4); (R1, C3, D4). If the fifth wolf is at (R3, C3, D1) or (R3, C3, D4) you will never know which one, because these combinations give exactly the same results, so the test fails.
$endgroup$
– Amorydai
yesterday
$begingroup$
Ah, that is correct about the ambiguous wolf. But how 65 tests and not 60?
$endgroup$
– nsinghs
yesterday
1
$begingroup$
there are 25 tests that go across the depths: R1C1 to R5C5. The other pools have 20 each, for a total of 65.
$endgroup$
– Amorydai
yesterday
$begingroup$
Ah shoot, I miscalculated. Thanks.
$endgroup$
– nsinghs
yesterday
add a comment |
2
$begingroup$
That’s an interesting approach. First of all 65 tests are possible, not 60. But more than that, unfortunately the test can give ambiguous results. This happens when three wolves make an intersection with no wolf there. For example, consider four wolves at (R3, C1, D1); (R1, C3, D1); (R3, C1, D4); (R1, C3, D4). If the fifth wolf is at (R3, C3, D1) or (R3, C3, D4) you will never know which one, because these combinations give exactly the same results, so the test fails.
$endgroup$
– Amorydai
yesterday
$begingroup$
Ah, that is correct about the ambiguous wolf. But how 65 tests and not 60?
$endgroup$
– nsinghs
yesterday
1
$begingroup$
there are 25 tests that go across the depths: R1C1 to R5C5. The other pools have 20 each, for a total of 65.
$endgroup$
– Amorydai
yesterday
$begingroup$
Ah shoot, I miscalculated. Thanks.
$endgroup$
– nsinghs
yesterday
2
2
$begingroup$
That’s an interesting approach. First of all 65 tests are possible, not 60. But more than that, unfortunately the test can give ambiguous results. This happens when three wolves make an intersection with no wolf there. For example, consider four wolves at (R3, C1, D1); (R1, C3, D1); (R3, C1, D4); (R1, C3, D4). If the fifth wolf is at (R3, C3, D1) or (R3, C3, D4) you will never know which one, because these combinations give exactly the same results, so the test fails.
$endgroup$
– Amorydai
yesterday
$begingroup$
That’s an interesting approach. First of all 65 tests are possible, not 60. But more than that, unfortunately the test can give ambiguous results. This happens when three wolves make an intersection with no wolf there. For example, consider four wolves at (R3, C1, D1); (R1, C3, D1); (R3, C1, D4); (R1, C3, D4). If the fifth wolf is at (R3, C3, D1) or (R3, C3, D4) you will never know which one, because these combinations give exactly the same results, so the test fails.
$endgroup$
– Amorydai
yesterday
$begingroup$
Ah, that is correct about the ambiguous wolf. But how 65 tests and not 60?
$endgroup$
– nsinghs
yesterday
$begingroup$
Ah, that is correct about the ambiguous wolf. But how 65 tests and not 60?
$endgroup$
– nsinghs
yesterday
1
1
$begingroup$
there are 25 tests that go across the depths: R1C1 to R5C5. The other pools have 20 each, for a total of 65.
$endgroup$
– Amorydai
yesterday
$begingroup$
there are 25 tests that go across the depths: R1C1 to R5C5. The other pools have 20 each, for a total of 65.
$endgroup$
– Amorydai
yesterday
$begingroup$
Ah shoot, I miscalculated. Thanks.
$endgroup$
– nsinghs
yesterday
$begingroup$
Ah shoot, I miscalculated. Thanks.
$endgroup$
– nsinghs
yesterday
add a comment |
$begingroup$
I don't have a solution, but I might have an approach.
Define 3 binary matrices:
$C$ is a list of all the combinations of 5 out of 100. So it has 100 columns, 75,287,520 rows and each row has 5 trues with the rest false.
$M$ is the measurement matrix which tells you what to measure on a given measurement. Each column tells you which sheep to measure in that test. It has 100 rows and $m$ columns (one for each measurement).
$R$ is the results matrix. It has 75,287,520 rows (one for each possible result) and $m$ columns (one for each test).
Then $Ccdot M = R$. Here we are doing normal matrix multiplication except that instead of multiplying the individual elements we are using the "and" operation, and instead of adding the pairs we are using the "or" operation. In other words:
beginequationR_i,j = cup_k=1^100(c_i,kcap m_k,j)endequation
where the $cap$ refers to the "logical and" operation and the $cup$ is the "logical or" operation.
What we want is to find a matrix $M$ such that each row of $R$ is unique and $m$ is as small as possible.
Now we can define $R$ to be simply the binary numbers in any order which would make $m=27$.
Then we'd have to find a left inverse of $C$ (using the same matrix operations as define above).
Suppose we can find $C^-1_mathrmleft$, a left inverse of $C$.
Then $M$ = $C^-1_mathrmleftcdot R$. This would be something like the transpose of @Quuxplusone's matrix for 6 sheep and 2 wolves.
Now, the inverse shoud be $C^-1_mathrmleft=(C^Tcdot C)^-1cdot C^T$.
C is quite a big matrix to inverse and I'm not sure what python would do with binary matrices. But, in theory, this is an approach that could work, assuming $C$ has a left inverse.
Note, that if it does have an inverse, then it can be done in 27 measurements. It would be interesting to try get this working for some of the simpler cases.
$endgroup$
add a comment |
$begingroup$
I don't have a solution, but I might have an approach.
Define 3 binary matrices:
$C$ is a list of all the combinations of 5 out of 100. So it has 100 columns, 75,287,520 rows and each row has 5 trues with the rest false.
$M$ is the measurement matrix which tells you what to measure on a given measurement. Each column tells you which sheep to measure in that test. It has 100 rows and $m$ columns (one for each measurement).
$R$ is the results matrix. It has 75,287,520 rows (one for each possible result) and $m$ columns (one for each test).
Then $Ccdot M = R$. Here we are doing normal matrix multiplication except that instead of multiplying the individual elements we are using the "and" operation, and instead of adding the pairs we are using the "or" operation. In other words:
beginequationR_i,j = cup_k=1^100(c_i,kcap m_k,j)endequation
where the $cap$ refers to the "logical and" operation and the $cup$ is the "logical or" operation.
What we want is to find a matrix $M$ such that each row of $R$ is unique and $m$ is as small as possible.
Now we can define $R$ to be simply the binary numbers in any order which would make $m=27$.
Then we'd have to find a left inverse of $C$ (using the same matrix operations as define above).
Suppose we can find $C^-1_mathrmleft$, a left inverse of $C$.
Then $M$ = $C^-1_mathrmleftcdot R$. This would be something like the transpose of @Quuxplusone's matrix for 6 sheep and 2 wolves.
Now, the inverse shoud be $C^-1_mathrmleft=(C^Tcdot C)^-1cdot C^T$.
C is quite a big matrix to inverse and I'm not sure what python would do with binary matrices. But, in theory, this is an approach that could work, assuming $C$ has a left inverse.
Note, that if it does have an inverse, then it can be done in 27 measurements. It would be interesting to try get this working for some of the simpler cases.
$endgroup$
add a comment |
$begingroup$
I don't have a solution, but I might have an approach.
Define 3 binary matrices:
$C$ is a list of all the combinations of 5 out of 100. So it has 100 columns, 75,287,520 rows and each row has 5 trues with the rest false.
$M$ is the measurement matrix which tells you what to measure on a given measurement. Each column tells you which sheep to measure in that test. It has 100 rows and $m$ columns (one for each measurement).
$R$ is the results matrix. It has 75,287,520 rows (one for each possible result) and $m$ columns (one for each test).
Then $Ccdot M = R$. Here we are doing normal matrix multiplication except that instead of multiplying the individual elements we are using the "and" operation, and instead of adding the pairs we are using the "or" operation. In other words:
beginequationR_i,j = cup_k=1^100(c_i,kcap m_k,j)endequation
where the $cap$ refers to the "logical and" operation and the $cup$ is the "logical or" operation.
What we want is to find a matrix $M$ such that each row of $R$ is unique and $m$ is as small as possible.
Now we can define $R$ to be simply the binary numbers in any order which would make $m=27$.
Then we'd have to find a left inverse of $C$ (using the same matrix operations as define above).
Suppose we can find $C^-1_mathrmleft$, a left inverse of $C$.
Then $M$ = $C^-1_mathrmleftcdot R$. This would be something like the transpose of @Quuxplusone's matrix for 6 sheep and 2 wolves.
Now, the inverse shoud be $C^-1_mathrmleft=(C^Tcdot C)^-1cdot C^T$.
C is quite a big matrix to inverse and I'm not sure what python would do with binary matrices. But, in theory, this is an approach that could work, assuming $C$ has a left inverse.
Note, that if it does have an inverse, then it can be done in 27 measurements. It would be interesting to try get this working for some of the simpler cases.
$endgroup$
I don't have a solution, but I might have an approach.
Define 3 binary matrices:
$C$ is a list of all the combinations of 5 out of 100. So it has 100 columns, 75,287,520 rows and each row has 5 trues with the rest false.
$M$ is the measurement matrix which tells you what to measure on a given measurement. Each column tells you which sheep to measure in that test. It has 100 rows and $m$ columns (one for each measurement).
$R$ is the results matrix. It has 75,287,520 rows (one for each possible result) and $m$ columns (one for each test).
Then $Ccdot M = R$. Here we are doing normal matrix multiplication except that instead of multiplying the individual elements we are using the "and" operation, and instead of adding the pairs we are using the "or" operation. In other words:
beginequationR_i,j = cup_k=1^100(c_i,kcap m_k,j)endequation
where the $cap$ refers to the "logical and" operation and the $cup$ is the "logical or" operation.
What we want is to find a matrix $M$ such that each row of $R$ is unique and $m$ is as small as possible.
Now we can define $R$ to be simply the binary numbers in any order which would make $m=27$.
Then we'd have to find a left inverse of $C$ (using the same matrix operations as define above).
Suppose we can find $C^-1_mathrmleft$, a left inverse of $C$.
Then $M$ = $C^-1_mathrmleftcdot R$. This would be something like the transpose of @Quuxplusone's matrix for 6 sheep and 2 wolves.
Now, the inverse shoud be $C^-1_mathrmleft=(C^Tcdot C)^-1cdot C^T$.
C is quite a big matrix to inverse and I'm not sure what python would do with binary matrices. But, in theory, this is an approach that could work, assuming $C$ has a left inverse.
Note, that if it does have an inverse, then it can be done in 27 measurements. It would be interesting to try get this working for some of the simpler cases.
edited 1 hour ago
answered 3 hours ago
Dr XorileDr Xorile
14.1k33083
14.1k33083
add a comment |
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
Apr 13 at 23:04
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
Apr 14 at 1:19
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
Apr 14 at 1:31
1
$begingroup$
@JyotishRobin, while I'm definitely not requesting to see your solution yet, I'm wondering: do you believe you know a solution involving 98-or-fewer tests? Do you believe you know the optimal solution? And if "yes" to either, a followup question: how confident are you in those beliefs? :)
$endgroup$
– Quuxplusone
yesterday