Calculate steps/progress of combinatorial problem Take five objects labeled 1, 2, 3, 4 and 5. Now try arranging them in all ways possible starting with
1 2 3 4 5

We will say that this is the first combination. Let's go a few steps forward
1 2 3 5 4
1 2 4 3 5
1 2 4 5 3
1 2 5 3 4
1 2 5 4 3
1 3 2 4 5
1 3 2 5 4
1 3 4 2 5
1 3 4 5 2
1 3 5 2 4
1 3 5 4 2

The last combination is
5 4 3 2 1

Is there a way to know how many steps need to be taken until you reach (for example)
3 5 2 1 4

without trying it out?
I have been trying to wrap my head around it but after spending too much time thinking about it, I wanted to ask if it is possible and if so, how to calculate the steps. If that is possible, an extension of this problem would be to add rotation to each object. The first combination followed by the next steps would be
1 2 3 4 5   everything 0°
1 2 3 4 5   everything 0° except 5 which is rotated by 90°
1 2 3 4 5   everything 0° except 5 which is rotated by 180°
1 2 3 4 5   everything 0° except 5 which is rotated by 270°
1 2 3 4 5   everything 0° except 4 which is rotated by 90°
1 2 3 4 5   everything 0° except 4 which is rotated by 90° and 5 by 90°
1 2 3 4 5   everything 0° except 4 which is rotated by 90° and 5 by 180°

Then last combination:
5 4 3 2 1   everything 270°

How many steps need to be taken to reach
3 5 2 1 4   3: 90°, 5: 180°, 2: 0°, 1: 270°, 4: 270°   

 A: Let's start with finding the indexing problem for permutations alone. The method is this; for each number $x$ which whose position is $i$ spots from from the left, you add up $$(5-i)!\times(\text{the number of numbers which are to the right of and less than $x$}).$$ The result is a number between $0$ and $5!-1$, inclusive, so it uses the zero-indexed convention. If you want the index to be between $1$ and $5!$, you must add one.
That is, if your permutation is $[\pi_1,\pi_2,\pi_3,\pi_4\pi_5]$, the index is
$$
4!\cdot \text{number of $\{\pi_2,\pi_3,\pi_4,\pi_5\}$ below $\pi_1$}+\\
3!\cdot \text{number of $\{\pi_3,\pi_4,\pi_5\}$ below $\pi_2$}+\\
2!\cdot \text{number of $\{\pi_4,\pi_5\}$ below $\pi_3$}+\\
1!\cdot \text{number of $\{\pi_5\}$ below $\pi_4$},\\
$$
possibly plus one depending on convention.
For $[3,5,2,1,4]$, this works out to be
$$
4!\cdot 2+3!\cdot 3+2!\cdot 1+1!\cdot 0=68
$$

It is simple to modify this to account for the rotations as well.
First of all, if you were ranking sequences of rotations alone, it would be very simple. Simple read the sequence of rotations as an integer in base $4$, using the correspondence
$$
0^\circ = 0,\qquad 90^\circ = 1,\qquad 180^\circ = 2,\qquad 270^\circ = 3
$$
For example, the zero-indexed rank of $[90,0,270,180,270]$ is $$1\cdot 4^4+0\cdot 4^3+3\cdot 4^2+2\cdot 4^1+3\cdot 4^0.$$ Finally, you can combine these using
$$
\text{rank}=(\text{zero-indexed permutation rank})\cdot 4^5+(\text{zero-indexed rotation rank})
$$
Again, this rank will be zero-indexed.
