Nice. A few thoughts/bugs:

1) Why is the result printed 4 times? I also noticed that (sometimes) the last two were the 'reverse' of the first two.
Did you use different methods of simplifying the...