  Six Numbers Solver Software

Description

Take six numbers and add, subtract, multiply, or divide some or all of them, in any order. The possibilities seem endless. This program examines all possible ways to achieve a specific result, and then reports how it got there. DOS Utility for Arithmetic Permutations in Six Terms

This problem is inspired from a popular television game show from France, called Les chiffres et les lettres (digits and letters) where contestants compete to solve the six numbers problem (without calculators) or at least get as close as possible to the target answer. The code was originally written in Borland Turbo Pascal 3.0 on a Toshiba T1000 laptop.

It is one thing to find a solution to the problem, but this program must also print an equation describing how to get the answer. Where there is more than one way to find a result, one answer using the fewest digits is reported. On the way, other targets are found, and noted. In this example, the program reported solutions not only for 863, but also for all targets up to 802.

One note... the six input numbers can each be in the range [1..100], but large numbers could overflow the internal (integer) computations. Target results cannot exceed 2500. The program is fast and efficient, and the solution search is believed to be exhaustive. Perhaps there is a solution for 802... are you game?

Give up yet?

Here is the actual program output for the above problem:

Problem #1

```  SIXNUMS.COM
Number 1:  6
Number 2: 11
Number 3:  5
Number 4:  9
Number 5:  4
Number 6:  7
----
Result? : 863```
`   863 = ( 11 x 6 x ( 9 + 4 ) ) + 5`

The program has efficiently found every possible solution...

Another Problem

What is the largest result possible using the numbers {1,2,3,4,5,6}?

Answer: Aiming for (say) 2000, the program reports:

` Closest is:  1080 = ( 5 x 4 x ( 2 + 1 ) x 3 ) x 6`
...which is also the largest possible result.

Want to try it yourself?

This free DOS utility is provided 'as-is' for your entertainment. No warranties are expressed or implied. Enjoy! Home