### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

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

### Site Stats

- 166,357 hits

Programming Enigma Puzzles

9 April 2012

Posted by on **From New Scientist #2705, 25th April 2009** [link]

The recycling plant accepts glass, metal and plastic items. For every four items of the same type that I feed it I receive 1 green point, so I will receive 10 points whether I feed it 40, 41, 42 or 43 plastic items.

I fed it a 2-digit number of glass items, a larger 2-digit number of metal items and an even larger 2-digit number of plastic items. I received a 1-digit number of points for each type of item. The digits 1 to 9 each appeared only once among those 2-digit and 1-digit numbers.

If I told you the total number of items that I fed it you would be able to deduce with certainty how many of them were glass, how many were metal and how many were plastic.

How many were metal?

[enigma1542]

Advertisements

%d bloggers like this:

Here’s my original Perl code. It runs in 29ms.

Solution:There were 27 metal items.Here’s a Python version. It builds up the pandigital requirement as it goes along and rejects candidates that won’t work. It runs in 41ms.