I came across this puzzle:
A wayfarer asks a shepherd how many sheep he has. He replies that if he numbered them two and two, or three and three, or four and four, or five and five, or six and six, there was always one over. If he numbered them by seven and seven there was none over. How many sheep had he?
It is relatively easy to find a solution using constraints that you can construct from the information in the puzzle (hints):
Constraint 1: The number of sheep must be a multiple of seven. This one is obvious.
Constraint 2: The number of sheep minus 1 must be a multiple of 60. This is the lowest number that has 2, 3, 4, 5 and 6 as divisors.
and using a little bit of trial and error (solution):
1 x 60 + 1 = 61, but is not a multiple of seven
2 x 60 + 1 = 121, but is not a multiple of seven
3 x 60 + 1 = 181, but is not a multiple of seven
4 x 60 + 1 = 241, but is not a multiple of seven
5 x 60 + 1 = 301 and is a multiple of seven. It is the lowest number of sheep that solves the puzzle
My questions now are:
1. Can this puzzle be solved without trial and error, using calculations or reasoning?
2. Is there only one solution?
I don't know the answers to these questions.
Answer
This is a system of equivalences. You may want to check the Chinese Remainder Theorem (which says that there is just one solution modulo 420): https://en.wikipedia.org/wiki/Chinese_remainder_theorem and the Extended Euclidean algorithm (which gives you a way to compute such systems in general): https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm
No comments:
Post a Comment