This solves numbers games according to the rules of the TV show Countdown.
Enter a selection of numbers separated by spaces, and an optional target, in the boxes above. Then press enter or click Go.
The selection is conventionally six numbers, but you can enter between two and eight. All the numbers in the selection and target (if given) must be positive integers.
If you enter a target, you'll see all the non-trivially different solutions for that target, and the solution counts for nearby targets.
If you don't enter a target, you'll see a map of all the targets (101-999) at once, colour coded by solveability with the given selection. Click on any target to see the solutions for it.
If you're using a mobile device, you might find this interface easier to use, but it doesn't have all the same features.
The following shortcuts may be included in the selection box to modify the behaviour of the solver.
|4L||Equivalent to 100 75 50 25. For example, 4L 6 3 expands to 100 75 50 25 6 3.|
|fast||Use the fast solver (see below) no matter how many numbers are in the selection. By default, the fast solver is only used when the selection contains more than 7 numbers.|
|@target||Use target as the target. Useful if you don't want the hassle of moving all the way over to the other box to type the target.|
This solver generates all legal expressions that can be made from the starting numbers, subject to some optimisations. It keeps the expressions that reach the target, or if it's not possible to reach the target, the expressions that get the closest to it.
The solver should solve every puzzle perfectly. If you find a solution to a puzzle which the solver claims is impossible, or you find a closer solution than the closest one it finds, then that's a bug.
The rules are as used by the numbers round on Countdown. The object of the game is to use the starting numbers and any combination of addition, subtraction, multiplication or division to reach the target number or as close as possible to it.
You don't have to use all the numbers, but each number may be used only once. Only positive integers may be used at any stage of the calculation. Negative numbers, powers and fractions are not allowed.
If you enter seven or fewer numbers in the selection, the solver will give you all the non-trivially different solutions for a given target. The solver considers two expressions to be equivalent, and therefore not different solutions, if both expressions do the same operations on the same numbers when their operations are rearranged into a standard order. This means you don't get all the trivial rearrangements of the same solution.
If you enter eight numbers in the selection, we use the "fast" solver to save time and memory. This agressively eliminates duplicate expressions by considering two expressions to be equivalent if they reach the same target with the same starting numbers. This mode only tells you whether each target is possible, and gives one example solution. However, it cannot tell you if this is the only solution or what other solutions may exist.
Trivially redundant operations which are never useful in the game are always ignored and not included in the expression. This includes introducing more operations to an expression after it has reached the target, multiplying or dividing by 1, or any part of an expression being equivalent to 2x − x or x² / x.
This solver was written by Graeme Cole and is released under a Creative Commons Attribution Licence. The source code is available on GitHub. It is not affiliated with or endorsed by Countdown or anyone connected with the show.