As you probably know, there are ( factorial) different ways to put the numbers from through (or any set of distinct objects) in a list. For example, here are the different lists containing the numbers through :

Each such list is called a *permutation*. Now, think about the above picture: the entire picture itself represents a *list* (read, say, top to bottom and then left to right) of all the permutations of . That is, it’s a permutation of permutations! And of course, there are (that is, about , *i.e* 620 sextillion, *i.e* six hundred thousand million million million, *i.e.* if you could count one trillion numbers every second, it would take you nineteen thousand years to count that high) different ways of putting the permutations in some order.

Look at the particular order given in the picture above. To go from the first permutation () to the second () requires only swapping two adjacent numbers—namely, and .

However, going from to the third permutation in the list () requires more than just a swap—the , , and all get reshuffled.

Consider also the transition from the sixth permutation () to the seventh (, at the top of the second column). It also requires just a swap of two numbers ( and )—but they are not adjacent.

Note by “adjacent” I mean adjacent *in the list*, not adjacent *as numbers*. For example, going from the penultimate () to the final permutation () also involves swapping and , but this time they are adjacent.

Here’s the question: can we put these permutations in some order so that the *only* kind of transition between successive permutations is a swap of two adjacent numbers?

Obviously, exhaustively searching through all 620 sextillion orders is out of the question, so we’ll have to be a bit more clever.

Rather than give away the answer, I think I’ll just stop and let you think about it. If you haven’t seen it before, this problem really makes for a great exploration, with all kinds of interesting structure and connections to discover. Can you figure out an ordering that works—or explain why it’s not possible? You might also want to try it for some simpler cases—say, permutations of and of . If you figure it out for , how about ?

In another post I’ll give the answer, and explain why people in 17th century England (!) cared about this problem (don’t give it away in the comments if you know!).

## About Brent

Assistant Professor of Computer Science at Hendrix College. Functional programmer, mathematician, teacher, pianist, follower of Jesus.

Here’s what I found out without cheating:

Let G be a graph where the vertices are permutations, and there is an edge between two vertices if there is a single element swap which transforms one permutation into the other. The question is asking if G has a Hamiltonian cycle. G is clearly vertex-transitive, so if the Lovász conjecture is true, then it does indeed have a Hamiltonian cycle. This strongly suggests that it can be done.

Of course, I couldn’t leave it at that. I did eventually cheat, and I now know who S, J and T are.

Drawing out the graph, it turns out to be a truncated octahedron. The truncated octahedron is also the order 4 permutohedron but the vertices don’t match up. Mysterious!

Ah, not so mysterious – taking “1 4 2 3” as the positions of the 4 digits yields “1 3 4 2” and those digits _do_ match up. Looking forward to the follow-up post.

I once read two very interesting articles about it. I will put references to them in your next post if you don’t mention them in your main text. However one article is an old writing in french. I don’t know if it has been translated. I like the way you bring things in this article. Step by step and then you leave us with a question🙂

def printer(n):

if n == 1:

yield [1]

elif n > 1:

for i, l in enumerate(printer(n – 1)):

for j in range(n)[::-1 if i % 2 == 0 else 1]:

yield l[:j] + [n] + l[j:]

for i in printer(4):

print i

Am I considered extremely ‘less traveled’ when I tell you that I just wrote the sequence down on paper with a sharpy in about 2 minutes? No math, no proof, just intuition?

The

mathis less traveled. I think it makesyou‘traveled’. =)That leaves you with a new problem: Can you repeat this with all permutations of N elements, for all possible N?

by induction i realise we can do that for permutations of all possible N. But i don’t know why “people in 17th century England (!) cared about this problem”. Looking forward to the next post…

Pingback: The Steinhaus-Johnson-Trotter algorithm | The Math Less Traveled

Pingback: Diagrams! | The Math Less Traveled