With the given numbers I need to make:

$7 \circ 8 \circ 7 \circ 7 \circ 8 \circ 3 = 100$

Using only the following operators:



$7 \times 8 + 7 \times 7 - 8 + 3 = 100$

  • $\begingroup$ This is pretty much it if we can't use parenthesis.. +1 $\endgroup$ – Raystafarian Nov 30 '15 at 16:30

General "Countdown" arithmetic puzzle solution !!

Some Unix Shells have a property called 'brace expansion'

The usage varies between csh and bash but is something like this:

echo {a,i}{s,t}


as at is it

This can be used to solve the "Countdown" letters puzzle, simply have 9 consecutive braces with all 9 letters in each. If you don't know Countdown, you can use this to find Scrabble™ words, if you add a final brace at the end like {'\n'} you even get one result per line so you can pipe output through sort or usr/dict

So how do we do the Arithmetic puzzle ?

If we are given the integers 2,4,5

Alternate braces containing integers and operators:

set array {2,4,5}{+,-,\*,/}{2,4,5}…{'\n'} # * escaped to avoid wildcard

This gives:


Every permutation of integer and operator. Finally,

foreach s in (array) {echo $s ; eval $s} | sort

Evaluates all the expressions and even sorts them so you can find the integer you are looking for and the expression which created it.

"Countdown"™ Solved !!!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.