### 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

23 November 2015

Posted by on **From New Scientist #2348, 22nd June 2002** [link]

The schoolteacher wanted to choose a certain small number of boys from his class. “In how many ways can I choose that number of boys?” he asked. The answer was a three-figure number. He then wanted to choose a certain smaller number of girls from the class. “In how many way can I choose that number of girls?” he asked. The answer was a three-figure number.

The teacher then wanted to choose a certain smaller number of children from the class as a whole. “In how many ways can I choose that number of children?” he asked. The answer was a three-figure number.

The three-figure answers above between them use all of the digits 1 to 9.

How many children were in the class?

[enigma1192]

Advertisements

%d bloggers like this:

The solution depends on your interpretation of “a small number” of children.

This Python program considers class sizes up to 100. It runs in 93ms.

Solution:There were 30 children in the class.The program examines class sizes up to 100, and comes up with several solutions. The smallest possible class size is 30 children.

There are 435 ways to choose 2 of the children from the class of 30.

One way to split up the class is into 12 boys and 18 girls.

There are 816 ways to choose 3 of the girls from the 18 girls in the class.

There are 792 ways to choose 5 of the boys from the 12 boys in the class.

This seems to be the most reasonable solution. The class is a reasonable size, and 5 could be considered a “small number” of boys.

However, there is a similar solution if we choose 7 of the 12 boys (as this is the same as choosing 5 of the boys

notto include in the group).We could also split the class into 18 boys and 12 girls, choose 5 (or 7) of the girls, and 15 of the boys. Although we are beginning to stretch the definition of “a small number” of boys.

The next smallest class size is 42, consisting of 30 boys and 12 girls. We choose 2 children from the whole class, 5 (or 7) of the girls, and 28 of the boys. I don’t think 28 (of 30) can really be considered “a small number”.

If we interpret the choice of children as implying there must be at least 2 children in the selected groups, then these are the only solutions.