Not sure you would post it to OEIS? All fine by me.
]]>So the longest path I have found is 74 steps, and the smallest number I have found that achieved this is 103682. (If my code is right.)
Maybe we could add this sequence onto OEIS!
Also, I chose to not allow leading 0s.
]]>Now you may transform this number into a different number by switching any two digits (let's say a and b) of this number.
However, you may only do so if the difference between those digits (a - b or b - a) is the same as their distance between them in this number.
We can start out by switching 1 and 2. No other move is possible.
Their difference: 2 - 1 = 1.
Their distance from each other in this number: They're right next to each other. So they're 1 apart from each other.
Difference and distance is the same, so we may switch them.
Now we get: 2153
And now the same thing applies. Which number(s) can we reach from this number? Seems like we can switch 1 and 3 here.
You may actually succeed in reversing all the digits. 1253 would be converted into 3521.
It would however take no less than 14 steps to do so. In fact, 3521 is the furthest away from 1253.
So the shortest path between them, takes 14 steps. And there is no other number that can be reached and that needs more steps to be reached, when using the shortest path to reach it.
Now here is a related problem which programmers may like, for any number n, what's the number that's furthest away from n?
And how many steps would you need to take to be able to reach it?
We have now solved it for 1253.
I've made a little program but I'm a lousy programmer.
The longest path I have found so far, is 72 steps long.
It's for the number 204075, among others.
(I have allowed it to let the 0 be the first digit when transforming it into another number. It was the simplest thing to do. But I've only started out with numbers that don't begin with a 0. You may choose to not allow a 0 in front, of course. Or to remove that 0 when it does come on front of the number.)
I wonder if anyone is interested in breaking the record.
]]>