There are 9 digit in the range of 1234566789 to 987654321 where each digit apear only once. Write a program that write 100 000th number in these sequence.
The first number is 123456789
The second number is 123456798
The third number is 123456879
No digit can repeat so 122345675 is not a valid number in this sequence.
Note the highlighted digit's position relative to the first number. The highlighted digit seems to move forward until it's at the end. That is, it swaps places with the next digit.
I've coded a prototype of my hypothesis and it seems to work.