4
$\begingroup$

I am trying to get 1234567. There are three levers, lever a, lever b, and lever c. Lever a shifts 1234567 to the right. So it would look like 2345671. Lever b swaps the third and fifth number. So it would look like 1254367. Lever c shifts 1234567 to the left. So it would look like 7123456. I currently have 1234657 how do i get to 1234567? I've been trying for a while and I can't get it.

$\endgroup$
  • 1
    $\begingroup$ You can forget about lever c as it amounts to pull lever a 6 times. $\endgroup$ – Arnaud Mortier Sep 9 '19 at 21:58
  • $\begingroup$ @ArnaudMortier as long as we are not counting the number of lever pulls. $\endgroup$ – Andrew Savinykh Sep 10 '19 at 8:39
  • $\begingroup$ Has a correct answer been given? If so, please don't forget to $\color{green}{\checkmark \small\text{Accept}}$ it :) $\endgroup$ – Rubio Sep 23 '19 at 2:02
5
$\begingroup$

First, note that

Up to using lever a appropriately, what lever b really allows you is to swap any two digits that are one place apart.

Therefore

you can first have the $5$ cycle to its final destination: $$1234657\stackrel{45}{\to} 1235647\stackrel{25}{\to} 1532647\stackrel{75}{\to} 1732645\stackrel{65}{\to} 1732546$$
and then the $6$: $$1732546\stackrel{67}{\to} 1632547\stackrel{62}{\to} 1236547\stackrel{64}{\to} 1234567$$

|improve this answer|||||
$\endgroup$
3
$\begingroup$

Same idea as @Arnuad, but in $5$ moves:

$$1234657\stackrel{51}{\to} 5234617\stackrel{53}{\to} 3254617\stackrel{56}{\to} 3264517\stackrel{63}{\to} 6234517\stackrel{61}{\to} 1234567$$

|improve this answer|||||
$\endgroup$
2
$\begingroup$

The fewest number of lever pulls is 12, of which 5 are swaps (b) and 7 are shifts (a and c). I verified this by computer.

1234657, Swap
1264357, Left
2643571, Swap
2653471, 2xRight
7126534, Swap
7156234, Right
4715623, Swap
4765123, Right
3476512, Swap
3456712, 2xRight
1234567

The way this works is that

the incorrect pair 65 jumps to the left, over the 34 pair, and then over the 12 pair, so that it ends up at the other side of the 7. You are essentially left with 1234765 which can be fixed with one more swap.

|improve this answer|||||
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.