In response to a challenge from Twitter user @7puzzle I was inspired to write a small PHP script that would generate all whole numbers created by a given function. Here's the original challenge:
"Using 1 2 3 and + - x ÷ available, it IS http://mathematicallypossible.com to make ALL target numbers 1-9. Is this statement TRUE or FALSE?" - @7puzzle
and here's the output of my routine:
1 = 1 - 1 + 1
1 = 1 - 2 + 2
1 = 1 - 3 + 3
1 = 1 * 1 * 1
1 = 1 * 1 / 1
1 = 1 * 2 - 1
1 = 1 * 2 / 2
1 = 1 * 3 - 2
1 = 1 * 3 / 3
1 = 1 / 1 * 1
1 = 1 / 1 / 1
1 = 1 / 2 * 2
1 = 1 / 3 * 3
1 = 1 + 1 - 1
1 = 1 + 2 - 2
1 = 1 + 3 - 3
1 = 2 - 1 * 1
1 = 2 - 1 / 1
1 = 2 - 2 / 2
1 = 2 - 2 + 1
1 = 2 - 3 / 3
1 = 2 - 3 + 2
1 = 2 * 1 - 1
1 = 2 * 1 / 2
1 = 2 * 2 - 3
1 = 2 / 1 - 1
1 = 2 / 1 / 2
1 = 2 / 2 * 1
1 = 2 / 2 / 1
1 = 2 + 1 - 2
1 = 2 + 2 - 3
1 = 3 - 1 - 1
1 = 3 - 1 * 2
1 = 3 - 2 * 1
1 = 3 - 2 / 1
1 = 3 - 3 + 1
1 = 3 * 1 - 2
1 = 3 * 1 / 3
1 = 3 / 1 - 2
1 = 3 / 1 / 3
1 = 3 / 3 * 1
1 = 3 / 3 / 1
1 = 3 + 1 - 3
2 = 1 - 1 + 2
2 = 1 - 2 + 3
2 = 1 * 1 * 2
2 = 1 * 1 + 1
2 = 1 * 2 * 1
2 = 1 * 2 / 1
2 = 1 * 3 - 1
2 = 1 / 1 * 2
2 = 1 / 1 + 1
2 = 1 + 1 * 1
2 = 1 + 1 / 1
2 = 1 + 2 - 1
2 = 1 + 2 / 2
2 = 1 + 3 - 2
2 = 1 + 3 / 3
2 = 2 - 1 + 1
2 = 2 - 2 + 2
2 = 2 - 3 + 3
2 = 2 * 1 * 1
2 = 2 * 1 / 1
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