### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

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

### Site Stats

- 175,242 hits

Advertisements

Programming Enigma Puzzles

13 March 2012

Posted by on **From New Scientist #2714, 27th June 2009** [link]

Harry and Tom each had a set of 15 red and six coloured snooker balls. Each of them had a bag, into which he put one or more of the red balls and four or more of the coloured balls from his set. Although Tom put more balls into his bag than Harry put into his bag, each of them calculated that if he picked four balls out of his bag simultaneously at random there was a 1 in X chance that all four would be coloured.

X represents the same number for each of them.

What number?

[enigma1551]

Advertisements

%d bloggers like this:

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

Solution:X = 14.This is how I would solve it now in Python. This code runs in 38ms.