Fix the perfectly ordered equation

This question is follow up to Something is wrong with the equation

This time our numbers are given as below included each numbers on a keyboard order and some basic math operators next to each other once.

By just swapping two squares at a time, find the equality with the least amount of swapping.

Note that when you put your result to Wolfram Alpha, it should say "True" as a result. so PEMDAS is necessary.

3 Answers

I can do it in

5 exchanges

The swaps are:

1 2 3 4 5 6 7 8 9 0 + - * / ! ^ = (Original)
1 2 3 4 5 6 7 8 ^ 0 + - * / ! 9 = (Swapped 9 and ^)
1 2 3 4 5 6 7 8 ^ 0 + - * / ! = 9 (Swapped 9 and =)
6 2 3 4 5 1 7 8 ^ 0 + - * / ! = 9 (Swapped 6 and 1)
6 / 3 4 5 1 7 8 ^ 0 + - * 2 ! = 9 (Swapped 2 and /)
6 / 3 - 5 1 7 8 ^ 0 + 4 * 2 ! = 9 (Swapped 4 and -)
To get 2 - 1 + 8 = 9

Alternate answer in the same number of swaps:

1 2 3 4 5 6 7 8 9 0 + - * / ! ^ = (Original)
1 7 3 4 5 6 2 8 9 0 + - * / ! ^ = (Swapped 2 and 7)
1 7 - 4 5 6 2 8 9 0 + 3 * / ! ^ = (Swapped 3 and -)
1 7 - 4 5 + 2 8 9 0 6 3 * / ! ^ = (Swapped 6 and +)
1 7 - 4 5 + 2 8 = 0 6 3 * / ! ^ 9 (Swapped 9 and =)
1 7 - 4 5 + 2 8 = 0 / 3 * 6 ! ^ 9 (Swapped 6 and /)
To get 17 - 45 + 28 = 0

Third answer using the same number of swaps:

1 2 3 4 5 6 7 8 9 0 + - * / ! ^ = (Original)
1 9 3 4 5 6 7 8 2 0 + - * / ! ^ = (Swapped 2 and 9)
1 9 3 4 5 6 7 8 * 0 + - 2 / ! ^ = (Swapped 2 and *)
1 9 3 4 5 6 7 8 * 0 + - ! / 2 ^ = (Swapped 2 and !)
1 9 = 4 5 6 7 8 * 0 + - ! / 2 ^ 3 (Swapped 3 and =)
1 9 = 4 - 6 7 8 * 0 + 5 ! / 2 ^ 3 (Swapped 5 and -)
to get 19 = 4 - 0 + 120 / 8

Fourth answer using the same number of swaps:

1 2 3 4 5 6 7 8 9 0 + - * / ! ^ = (Original)
4 2 3 1 5 6 7 8 9 0 + - * / ! ^ = (Swapped 1 and 4)
4 2 3 / 5 6 7 8 9 0 + - * 1 ! ^ = (Swapped 1 and /)
4 2 0 / 5 6 7 8 9 3 + - * 1 ! ^ = (Swapped 0 and 3)
4 2 0 / 5 = 7 8 9 3 + - * 1 ! ^ 6 (Swapped 0 and 3)
4 2 0 / 5 = 7 8 - 3 + 9 * 1 ! ^ 6 (Swapped - and 9)
To get 84 = 84

Fifth answer using the same number of swaps:

1 2 3 4 5 6 7 8 9 0 + - * / ! ^ = (Original)
8 2 3 4 5 6 7 1 9 0 + - * / ! ^ = (Swapped 1 and 8)
8 2 3 4 5 6 7 + 9 0 1 - * / ! ^ = (Swapped 1 and +)
8 2 3 4 5 6 7 + 9 0 / - * 1 ! ^ = (Swapped 1 and /)
8 2 - 4 5 6 7 + 9 0 / 3 * 1 ! ^ = (Swapped 3 and -)
8 2 - 4 5 = 7 + 9 0 / 3 * 1 ! ^ 6 (Swapped 6 and =)
to get 37 = 37.

A quite amazing sixth answer using the same number of swaps:

1 2 3 4 5 6 7 8 9 0 + - * / ! ^ = (Original)
1 6 3 4 5 2 7 8 9 0 + - * / ! ^ = (Swapped 6 and 2)
1 6 ^ 4 5 2 7 8 9 0 + - * / ! 3 = (Swapped 3 and ^)
1 6 ^ 4 / 2 7 8 9 0 + - * 5 ! 3 = (Swapped 5 and /)
1 6 ^ 4 / 2 - 8 9 0 + 7 * 5 ! 3 = (Swapped 7 and -)
1 6 ^ 4 / 2 - 8 = 0 + 7 * 5 ! 3 9 (Swapped 9 and =)
to arrive at 32760 = 32760. (Entering "16^4/2-8=0+7*5!39" gives "True" on Wolfram Alpha)

————————————————————————————————————————————

Edit: So I realized that the question statement says that

Note that when you put your result to Wolfram Alpha, it should say "True" as a result.

Hence we can cheese the question and use just:

3 exchanges

Via the following swaps:

1 2 3 4 5 6 7 8 9 0 + - * / ! ^ = (Original)
1 2 3 ! 5 6 7 8 9 0 + - * / 4 ^ = (Swapped 4 and !)
1 2 3 ! = 6 7 8 9 0 + - * / 4 ^ 5 (Swapped 5 and =)
1 2 3 ! = 6 7 * 9 0 + - 8 / 4 ^ 5 (Swapped 8 and *)
if you enter "123!=67*90+-8/4^5" on Wolfram Alpha it will return "True" as 123 != 6029.9921875 (Though it is noted that the question does mention "equality", hence this funny answer isn't valid)

• :) pretty good answers – Oray Sep 7 '18 at 16:06
• @Oray is it optimal though? – lovemathboy Sep 7 '18 at 16:06
• i found it 5 swaps as well, not sure 4 is possible, i will wait a day, then accept your answer – Oray Sep 7 '18 at 19:34

A possible solution using 13 swaps:

1 x 3 ! + 9 - 2 ^ 0 = 6 5 8 / 4 7

Which boils down to

14 = 14

Swaps:

1 2 3 4 5 6 7 8 9 0 + - x / ! ^ =
1 x 3 4 5 6 7 8 9 0 + - 2 / ! ^ =
1 x 3 ! 5 6 7 8 9 0 + - 2 / 4 ^ =
1 x 3 ! + 6 7 8 9 0 5 - 2 / 4 ^ =
1 x 3 ! + 9 7 8 6 0 5 - 2 / 4 ^ =
1 x 3 ! + 9 - 8 6 0 5 7 2 / 4 ^ =
1 x 3 ! + 9 - 2 6 0 5 7 8 / 4 ^ =
1 x 3 ! + 9 - 2 ^ 0 5 7 8 / 4 6 =
1 x 3 ! + 9 - 2 ^ 0 = 7 8 / 4 6 5
1 x 3 ! + 9 - 2 ^ 0 = 6 8 / 4 7 5
1 x 3 ! + 9 - 2 ^ 0 = 6 5 / 4 7 8
1 x 3 ! + 9 - 2 ^ 0 = 6 5 8 4 7 /
1 x 3 ! + 9 - 2 ^ 0 = 6 5 8 / 7 4
1 x 3 ! + 9 - 2 ^ 0 = 6 5 8 / 4 7

I'm sure there's a solution using less swaps, so consider this the benchmark to break.

I think I can do it in

$9$ exchanges

Swaps

1 2 3 4 5 6 7 8 9 0 + - x / ! ^ =
1 ^ 3 4 5 6 7 8 9 0 + - x / ! 2 =
1 ^ 3 ! 5 6 7 8 9 0 + - x / 4 2 =
1 ^ 3 ! - 6 7 8 9 0 + 5 x / 4 2 =
1 ^ 3 ! - 6 5 8 9 0 + 7 x / 4 2 =
1 ^ 3 ! - 6 5 8 x 0 + 7 9 / 4 2 =
1 ^ 3 ! - 6 5 8 x 0 + 2 9 / 4 7 =
1 ^ 3 ! - 6 5 8 x 0 + 2 7 / 4 9 =
1 ^ 3 ! - 6 5 8 x 0 + 2 7 / 9 4 =
1 ^ 3 ! - 6 5 8 x 0 + 2 7 / 9 = 4