### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

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

### Site Stats

- 168,282 hits

Programming Enigma Puzzles

7 May 2013

Posted by on **From New Scientist #2594, 10th March 2007**

I have been introducing my niece and nephew to a simple form of the game of cribbage. I have discarded the “picture” cards from a standard pack of cards, leaving 40 cards. The aces count as ones. I give each of us four of the cards and explain how to work out the score of each hand. Each pair of identical numbers scores two points. Each group of cards adding up to 15 scores another two points. If the four cards have consecutive numbers on them they score a further four points, but if not then any three of the cards which have consecutive numbers on them score another three points. So, for example, a hand comprising 3, 4, 5 and 5 would score eight points and a hand comprising 7, 8, 8, 8 would score 12 points.

In one interesting deal the three of us each had four cards whose score equalled the total of their faces. I then shuffled just those 12 cards and gave us four each again. This time we all had different score from each other, but for each hand the sum of the face values was a multiple (larger than 1) of the score.

What (in increasing order of scores) were the three hands on that last occasion?

[enigma1433]

Advertisements

%d bloggers like this:

The following Python program runs in 60ms. In Python 3 the last line of the recursive

solve()function could be replaced with ayield fromconstruct. I left it as a loop so that it works with Python 2 or Python 3.Solution:The hands were as follows: score = 2, cards = 1, 2, 2, 5; score = 4, cards = 1, 1, 3, 3; score = 8, cards = 1, 5, 5, 5.