### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,176)
- misc (2)
- project euler (2)
- puzzle (44)
- site news (46)
- tantalizer (48)
- teaser (3)

### Site Stats

- 183,172 hits

Advertisements

Programming Enigma Puzzles

30 January 2014

Posted by on **From New Scientist #1310, 17th June 1982** [link]

Teacher gave each child 150 counters for number games.

“Make a row of piles of counters,” she said, “with each pile bigger than the previous one, and increasing by the same number each time. You needn’t use all your counters. Next, add up the total number of counters in one pile, two piles, three piles and so on. Then tell me what you notice.”

Little Alec was the first to put his hand up.

“Please miss,” he said, “all my totals are perfect squares.”

There being no other offers, Teacher tried another game.

“Now make another row, with each pile bigger than the previous one, but this time you must multiply by the same number each time to find out how big the next pile must be. Carry on until you haven’t enough counters left for another pile. Then add up the total number of counters in one pile, two piles, three piles and so on, as before. Then tell me what you notice.”

Again little Alec was the first to finish.

“Please miss,” he said, “my first two totals are the same as in the first game, and I’ve used the same number of counters altogether.”

How many was that?

[enigma165]

Advertisements

%d bloggers like this:

This Python program runs in 34ms.

Solution:Alec used 121 counters in each of the games.For the first game the sizes of the piles are: 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21. Each pile having 2 more counters than the previous pile.

For the second game the sizes of the piles are: 1, 3, 9, 27, 81. Each pile having 3 times the number of counters of the previous pile.

In order to arrive at an interesting and unique solution we have to suppose that Alec creates rows with more than two piles in (perhaps prompted by the teachers instructions to find the total number of counters in “the first three piles, and so on”). Without this constraint there are many degenerate solutions of two piles that satisfy the rules for either game.