### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,123)
- misc (2)
- project euler (2)
- puzzle (31)
- site news (43)
- tantalizer (31)
- teaser (3)

### Site Stats

- 168,282 hits

Programming Enigma Puzzles

14 March 2015

Posted by on **From New Scientist #1412, 31st May 1984** [link]

And in the evening it came to pass that the father summoned his four sons from the field and said unto them, “You have all found favour in my sight. My store is greater by two and twenty sacks of corn”.

Then spake Absalom to his father saying, “Father thou has told me that I did fill more sacks than any of my brothers. Give me therefore the reward, for I am the most worthy”. And the father rebuked Absalom saying, “Thy worth is no greater than thy brothers for each gave of his best, yet no two of you did fill the same number of sacks. Let instead the reward be to him who showeth the greatest wisdom”.

And he said unto Absalom, “Tell me how many sacks did each of thy brothers fill?” And Absalom knew not.

And he said unto Benjamin, “Thy sacks and the sacks of thy brother Caleb did together equal the sacks of Absalom. How many were the sacks of Caleb?” And Benjamin knew not.

And Caleb hearing these things yet did not know the sacks of Benjamin.

Then spake David saying, “Father, thou hast known me as a fool in the shadow of my brothers, yet if I may assume them to be perfect in the ways of logic and deduction then even I can give thee the numbers”. And he spake truly and was rewarded. And his father said: “Verily the fool who listens well with receive wisdom”.

If Benjamin didn’t bring back the fewest sacks, what was David’s answer?

This is the 800th *Enigma* puzzle to go up on the site. In total just under 45% of all *Enigmas* published are now available (there are about 980 to go).

[enigma265]

Advertisements

%d bloggers like this:

This Python 3 program runs in 58ms.

Solution:David’s answer is that Absalom filled 9 sacks, Benjamin filled 6 sacks and Caleb filled 3 sacks.David himself must have filled 4 sacks to bring the total to 22.

As observers we can determine that by the end that (A, B, C, D) is one of (8, 1, 7, 6) or (9, 6, 3, 4). As we are told B is not the smallest we can then determine the answer.

I am having a few issues with this one. In Mathematica ‘IntegerPartitions’ orders the list left to right in size order, for example the Partitions of 12 into 3 parts is:-

{{9,2,1}, {8,3,1}, {7,4,1}, {7,3,2}, {6,5,1}, {6,4,2}, {5,4,3}}. This naturally preserves the logic that A>B and that B is not the smallest. So using this and the other logic in this MMA code. I get multiple solutions that would all seem correct.

The 4th digit in each set is the number of sacks David filled, i.e. {2, 4, 6}. So what other logic is needed or I missed that would exclude the superfluous solutions?. btw the timing for this was <1ms.

Paul.

B knows that A + B + C + D = 22, A > (B, C, D), (B, C, D) are distinct, A = B + C, and also he knows the value of B.

But when he is asked if he knows the value of C he cannot say, so there must be multiple possibilities for the value of C given the value of B.

So, as observers, we can eliminate any possibilities where given the value of B there is a single corresponding value of C.

These are: (B, C) = (2, 7), (4, 6), (5, 3), (8, 1), (9, 1).

Which eliminates the following values for (A, B, C, D): (9, 2, 7, 4), (10, 4, 6, 2), (8, 5, 3, 6), (9, 8, 1, 4), (10, 9, 1, 2).

Similarly we can eliminate further values given the responses of C and D, until we are left with just 2 candidate assignments for (A, B, C, D).

We (as the observers) are then told that B is not the smallest value, and this eliminates one of the 2 candidate assignments, leaving only (A, B, C, D) = (9, 6, 3, 4).