# Equation Generator

Here are a few problems involving Recursion that could give you a few sleepless nights, and a lot of satisfaction once you solve them. I hope you've read my articles on programming Magic Squares, Tic Tac Toe, Connect 4, etc., because those problems have been some of my favorites.

## License Plate numbers

I once found myself reading license plate numbers and trying to make equations out of them. A really fun way to pass your time traveling. However, I tried making a program to do the same, and found it really challenging.

You are given a 4-digit number. For example, 1234. Now, you've got to make an equation out of it, by placing arithmetic operators and an equal-to sign in between the digits.
1=2+3-4
1-2=3-4
-1+2+3=4
12=3*4
12/3=4
1^2+3=4
etc.

Now, the output should be such that the simpler equations (like those involving + and -) come first, before complex equations involving *, /, raised-to, etc.

Take another example: 7777. The output should be in this order (ignoring unary negation):-
77=77
7=7=7=7
7+7=7+7
7=7+7-7
7=7-7+7
7+7-7=7
7-7+7=7
7-7=7-7
7*7=7*7
7=7*7/7
7=7/7*7
etc.

Try supporting as many of the following operators as possible:-
=, +, -, *, /, ^, - (unary negation), % (modulo), \ (integer division), brackets, etc.

 erw_nerve@email.com April 2000

 http://personal.vsnl.com/erwin/recursion.htm 