# Enigmatic Code

Programming Enigma Puzzles

## Tantalizer 433: Service break

From New Scientist #984, 22nd January 1976 [link]

Once a year, when the sand is right for sand castles, the trout are rising nicely in the streams and the hart is doing its proverbial panting, the New Scientist decides to remove the grime from its typewriters and moth from its editors. The latter then take off for the hills, having summoned the old team of Amble, Bumble, Crumble and Dimwit to attend the former.

The task always takes longer than it should because the four worthies are not all available. Three years ago Amble, Bumble and Crumble did it in 12 days. Two years ago Bumble, Crumble and Dimwit managed it in 15 days. Last year Amble, Crumble and Dimwit knocked it off in 18 days. And this year Amble, Bumble and Dimwit were expecting to romp through it in 20 days, until Amble and Bumble fell under a bus.

If the whole job falls on Dimwit, how many days will it take?

[tantalizer433]

### 4 responses to “Tantalizer 433: Service break”

1. Jim Randell 20 March 2019 at 8:02 am

Suppose there is 1 unit of work to be done, and A, B, C, D represent how much work each person can do in a day, then we have the following equations:

12(A + B + C) = 1
15(B + C + D) = 1
18(A + C + D) = 1
20(A + B + D) = 1

These equations are solved to give:

A = 1/54, B = 4/135, C = 19/540, D = 1/540

Here’s a program that uses the Gaussian elimination solver for linear equations in the enigma.py library. (Originally written for Enigma 287). It runs in 91ms.

Run: [ @repl.it ]

```from enigma import matrix, printf

# the equations
eqs = [
#  A   B   C   D = k
([12, 12, 12,  0], 1),
([ 0, 15, 15, 15], 1),
([18,  0, 18, 18], 1),
([20, 20,  0, 20], 1),
]

# solve the equations
(A, B, C, D) = matrix.linear(*zip(*eqs))
printf("A = {A}, B = {B}, C = {C}, D = {D}")
```

Solution: It would take Dimwit 540 days to complete to task by himself.

That is nearly 1.5 years, which for a yearly task is a bit long.

Although if Crumble comes to help they could manage it between them in 27 days.

2. paul2cleary 20 March 2019 at 12:21 pm

Run it for 17, 23, 26, 28 days in that order.

• Jim Randell 20 March 2019 at 2:10 pm

If we look at the proportion of work done by each, then in the original puzzle it is:

A+B+C: (12 days) A = 22.22%, B = 35.56%, C = 42.22%
B+C+D: (15 days) B = 44.44%, C = 52.78%, D = 2.78%
A+C+D: (18 days) A = 33.33%, C = 63.33%, D = 3.33%
A+B+D: (20 days) A = 37.04%, B = 59.26%, D = 3.70%

If you thought D wasn’t pulling his weight, in Paul’s variation we have:

A+B+C: (17 days) A = 26.09%, B = 34.62%, C = 39.29%
B+C+D: (23 days) B = 46.84%, C = 53.16%, D = 0.01%
A+C+D: (26 days) A = 39.90%, C = 60.09%, D = 0.01%
A+B+D: (28 days) A = 42.97%, B = 57.02%, D = 0.01%

To do the task by himself it would take D nearly 1169 years.

3. Brian Gladman 21 March 2019 at 8:02 am
```# Let the work rates be A, B, C and D and the fraction
# denominators be e, f, g and h (12, 15, 18, 20) so that:
#
#   A + B + C = 1/e  (1)
#   B + C + D = 1/f  (2)
#   A + C + D = 1/g  (3)
#   A + B + D = 1/h  (4)
#
#   A - D = 1/e - 1/f  (5) = (1) - (2)
#   B - D = 1/e - 1/g  (6) = (1) - (3)
#   C - D = 1/e - 1/h  (7) = (1) - (4)
#
# Substitute for A, B and C from (5)..(7) into (1)
# to give D and then A, B and C:
#
# (D, A, B, C) = (s - 1/e, s - 1/f, s - 1/g, s - 1/h)
#
# where s = (1/ e + 1/f + 1/g + 1/h) / 3

from fractions import Fraction as RF

t = (12, 15, 18, 20)
s = sum(RF(1, 3 * x) for x in t)
D, A, B, C = (s - RF(1, x) for x in t)
print(f"{1/D} days (A = {A}, B = {B}, C = {C}, D = {D}).")
```

This site uses Akismet to reduce spam. Learn how your comment data is processed.