Volume 9, Issue 2 Articles Tricks of the Trade In and Out Trott's Corner New Products New Publications Calendar News Bulletins New Resources Classifieds Download This Issue Editorial Policy Staff Submissions Subscriptions Advertising Back Issues Contact Information 
Algebraic Programming in Mathematica
5. The Hard 4 Fours Problem The hard version of the problem is to find all possible representations of all numbers between 1 and 99 using any "reasonable" operations, including unary ones ("functions") like Sqrt or Factorial. Of course there is now an infinite number of possible ways of trying to write out a solution, even with a finite number of operations. We shall therefore concentrate only on representations using Sqrt and Factorial in addition to the usual arithmetic operations, and only try to find some additional solutions. (If the additional operations were binary [e.g., Max or Min] then we could use exactly the same method as before to obtain a complete solution.) We first introduce modified definitions of the additional operations.
We create a new set of rules that transform our unary functions into factorial, sqrt, or Identity to account for the cases where no unary operation is used.
We see that there are rather a lot of identical rules. We can reduce their number.
The most obvious expressions to evaluate are obtained from the earlier ones by replacing all fours by .
Here are all the solutions we get in this way.
An interesting case is the number 31, which was not among the solutions we got earlier. Let us see how it is represented.
Of course there are in principle infinitely many ways to insert more Bs into different slots, and it is not clear how many more numbers can be obtained in this way. Here is just one example. Consider the pattern .
We see that it produced just one new number.
However, we created several new representations for the solutions already found. Here is another representation of 31.
Here are all the solutions we have found so far.
Here are the remaining outstanding numbers.
See if you can find interesting representations of these, possibly using some other operations.


About Mathematica  Download Mathematica Player Copyright © Wolfram Media, Inc. All rights reserved. 