1

Is it possible to write a math formula involving possible permutations, such as for the letters "ABC" in uppercase, no repeated combinations, and always generated in a static unchanging order.

Such as e.g., [A, B, C]

ABC # 1 
CBA # 2
BCA # 3
CAB # 5
ACB # 4
BAC # 5

If given #4 not the actual value of "ACB", find that the value of the fourth iteration in the sequence would have been equal to ACB.

Is this possible without re-generating combinations or appending a key to a value?

CONTEXT: Trying to generate combinations from a static array of numbers in computer programming, and then by giving a key value such as an iteration number count, figure what the permutation would have been.

ABC
  • 113
  • 1
    Search the web for formula for nth permutation. Here's one link: https://stackoverflow.com/questions/7918806/finding-n-th-permutation-without-computing-others. For $k$ characters and $k!$ is small enough, precompute an array. PS I think the indexing in your example is wrong. And there is no etc. for three characters (you have them all). And it's best to list them lexicographically. – Ethan Bolker May 22 '19 at 16:30
  • @EthanBolker I skipped the math courses and was not sure If I was wording things correctly. – ABC May 22 '19 at 16:32
  • 1
    The wording is a little clumsy but I think I understood what you wanted. The context helped. The word you want is "permutation", not "combination". – Ethan Bolker May 22 '19 at 16:36
  • Thanks for the helping in figuring out "finding the nth permutation in lexical order of a string". What is it called for the reversed, so instead of finding the nth positions value, you find the position by value (reversed of this). – ABC May 22 '19 at 17:42
  • 1
    There is no necessary order on the permutations (though lexicographical is common) so the only way to do the reverse lookup ((absent an actual table) is to write the inverse of the algorithm that you use to calculate the position. – Ethan Bolker May 22 '19 at 20:25

0 Answers0