### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,270)
- misc (3)
- project euler (2)
- puzzle (67)
- site news (50)
- tantalizer (69)
- teaser (7)

### Site Stats

- 206,369 hits

Programming Enigma Puzzles

4 January 2019

Posted by on **From New Scientist #2185, 8th May 1999** [link]

The company Chancelot has been asked to set up a lottery for a foreign country. It will work a bit like Britain’s own lottery with participants choosing some numbers: then the winning numbers will be decided by the company choosing some numbered balls at random.

The government has laid down some strict guidelines:

1. It wants participants to have to choose six numbers from 1, 2, …, N, where the top number N has not yet been decided. Then six of the numbered balls will be chosen and the winner’s choices must match all six.

2. It believes that the public is always suspicious when the winning selection includes two consecutive numbers. Therefore of all the combinations of six numbers from the N, it wants more than half of them not to include two consecutive numbers.

3. To give the public a fair chance of winning, it wants N to be the lowest possible satisfying the above conditions.

How many balls will there be in Chancelot’s lottery?

[enigma1029]

%d bloggers like this:

The number of different ways of choosing 6 numbers from

Nis:C(N, 6).One way to count the number of non-consecutive choices is to think of the numbers chosen in order:

and no two of them are consecutive, so we can move

fone closer toe, and then moveeandfone closer tod, and so on, until we end up with:This maps any non-consecutive choice of 6 numbers from

Nonto a normal choice of 6 numbers from(N – 5), and vice versa.So the number of non-consecutive choices of 6 numbers from

Nis:C(N – 5, 6).We want the non-consecutive choices to be more than half of the total choices:

This Python program looks for the lowest number of balls that will achieve this. It runs in 84ms.

Run:[ @repl.it ]Solution:There will be 49 balls in the lottery.