### Random Post

### Recent Posts

### Recent Comments

Jim Randell on Enigma 1691: Factory part… | |

Jim Randell on Puzzle 52: Football on the Isl… | |

geoffrounce on Enigma 1691: Factory part… | |

Hugh Casement on Enigma 1070: Time to work | |

Jim Randell on Enigma 1070: Time to work |

### Archives

### Categories

- article (11)
- enigma (1,157)
- misc (2)
- project euler (2)
- puzzle (40)
- site news (44)
- tantalizer (42)
- teaser (3)

### Site Stats

- 177,808 hits

Advertisements

I tried to write a program that makes as few assumptions as possible about the problem, as too much analysis can leave little for the program to do. The first program I wrote required an arbitrary limit on the maximum amount that an individual goodie can cost. I don’t like arbitrary limits, so I wrote this program, which considers increasing values of goodies until it finds a solution. I’m not entirely happy with this approach either, because as it constructs larger sets of goodies to try it is repeating the testing of the smaller sets. But it finds a solution in 69ms, so I’m not going to worry about it for now. Also it stops looking when it finds the first solution (but as we shall see there is only a single solution).

Solution:The total amount of money give to the boys is 48p.Each boy bought 3 goodies.

One boy received 6p, and bought goodies costing 1p, 2p and 3p.

One boy received 7½p, and bought goodies costing 1p, 1½p and 5p.

One boy received 9p, and bought goodies costing ½p, 4p and 4½p.

One boy received 10½p, and bought goodies costing ½p, 3p and 7p.

One boy received 15p, and bought goodies costing ½p, 2½ p, 12p.

Analytically it is fairly straightforward to show that the only sets of distinct positive integers where the product is the same as the sum are singleton sets, or {1, 2, 3}.

So this tells us straight away that each boy bought 3 goodies, and that one of the boys spent 6p on goodies costing 1p, 2p and 3p.

So we consider the values of the equation:

where a, b, c represent the prices of the three goodies in whole numbers of half pennies.

For a given a and b we have:

For a fixed value of a, we can consider the curves:

These cross at:

this gives us an upper bound for values of b, and we already have a < b as a lower bound for b.

For a = 1, we get:

which gives us the following solutions: (b, c) = (5, 24), (6, 14), (8, 9).

For a = 2, we get:

which gives us the following solutions: (b, c) = (3, 10), (4, 6).

For a = 3, we get:

These solutions correspond to the five amounts given to the boys (in half-pennies), and each sums to a different total:

and exactly one of them is a set of whole pennies, as required.

Hence the total amount given to the boys is 15p + 10½p + 9p + 7½p + 6p = 48p.

MiniZinc (Constraint Programming) approach: http://hakank.org/minizinc/enigma_248_add_or_multiply.mzn

The number of goodies per boy (3) and some appropriate upper limit for the price was found by experimentation.

It shows the unique solution as the above comments.