### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,367)
- misc (4)
- project euler (2)
- puzzle (90)
- puzzle# (48)
- site news (58)
- tantalizer (94)
- teaser (7)

### Site Stats

- 233,130 hits

Programming Enigma Puzzles

20 December 2019

Posted by on **From New Scientist #2134, 16th May 1998** [link]

Triangular numbers are those that fit the formula

n(n + 1)/2,so that the sequence starts: 1, 3, 6, 10, 15, 21, 28, …From the first 30 triangular numbers select a set that uses each of the ten digits 0 to 9 once.

1. What are the largest and smallest numbers in your set?

In the Fibonacci sequences the first two terms are 1 and 1 and each succeeding term is the sum of the previous two terms, so that sequence starts: 1, 1, 2, 3, 5, 8, 13, …

From the first 30 Fibonacci numbers select a set that uses each of the ten digits 0 to 9 once.

2. What are the largest and smallest numbers in your set?

[enigma979]

%d bloggers like this:

I am assuming we want the sets to use each digit

exactlyonce (otherwise the entire sets of 30 numbers would do).This Python 3 program runs in 91ms.

Run:[ @repl.it ]Solution:(1) The largest number is 406. The smallest number is 78. (2) The largest number is 987. The smallest number is 2.There are two possible sets for part (1):

But only one set for part (2):