UNB DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING

Richard Tervo, Ph.D.
Professor


E-Mail: tervo@unb.ca Phone: +1-506-447-3137


Arithmetic Permutations in Six Numbers

This page solves math puzzles in which the challenge is to combine up to six numbers using (+ − × /) operators to achieve a given result. Alternatively, if the desired result cannot be obtained, then the closest possible answer should be shown.

In France, this puzzle is the basis for a popular television game show called "Le Compte est Bon". Contestants may not use calculators! You may prefer to use this website to find solutions.


What's the Problem?

For example, looking for 99 using the six numbers (2 4 6 8 10 12) yields an exact solution with four of the numbers:

99 = (6 / 2) + (8 × 12)

The software challenge in developing this website was twofold. Firstly, with six input numbers and four possible operations, the number of potential outcomes grows quickly. There are some constraints on the input values (see below). Secondly, the program must report how it arrived at a given answer, so the method must be tracked throughout the computations. The underlying program is written entirely in Perl.


Try it yourself...

Enter six numbers and a target value:
Numbers in the range (1..100) and target value (1..999):

( , , , , , ) = 


Home