0
$\begingroup$

Let's assume that we have a number sequence which starts as

1# -1 2 3 4 5 6 7 8 9
2# -1 2 3 4 5 6 7 9 8
3# -1 2 3 4 5 6 8 7 9

n# -9 8 7 6 5 4 3 2 1

There could be approximately 3000 such occurrences in between, What would be the pattern to generate these numbers...

Regards!

  • 0
    This appears to be the list of the [permutations](https://en.wikipedia.org/wiki/Permutation) of $\{1,2,\dots,9\}$ written in [lexicographic ordering](https://en.wikipedia.org/wiki/Lexicographical_order). Note that $987\dots21$ would in fact be term number $9!=362880$ in the sequence if that were correct. See [this related question](http://math.stackexchange.com/questions/60742/finding-the-n-th-lexicographic-permutation-of-a-string). [This portion of the wiki page](https://en.wikipedia.org/wiki/Permutation#Generation_in_lexicographic_order) is also useful.2017-02-23

1 Answers 1

0

If you notice carefully, this is what is going on apparently:

In each case, we shift the entries $e_n, \cdots, e_8$ one place to the right and put $e_9$ in the $n$-th position. We do this with $n$ starting from $8$ and going down all the way to $1$, and repeat the loop till we get the sequence $9, 8, 7, \cdots, 1$.