Ben R. answered • 03/11/20

PhD in Mathematics, 9 years college teaching experience

If generating the permutations isn't too bad, one way to consider a difference between these permutations could be to create a distance function/metric

"Distance" between abcde and vwxyz = |a-v| + |b-w| + |c-x| + |d-y| + |e-z|

With this kind of metric, the distance between 10001 and 21112 would be 5, but the distance between 10001 and 32223 would be 10.

With this in mind, you could examine all of the permutations of the desired form and always pick the one with largest possible distance

I'm not sure if this is the kind of thing you're looking for or not

Alex S.

Thank you very much for your suggestion !!! In the end, this is not what I have been looking for. Because the numbers in my permutations actually represent different kinds of musical instruments so the distance is not necessary. However it somehow flipped something in my brain and I came up with something, which for now seems like the solution. Although I will need to still do some testing. It goes like this: after first arbitrary row 30123 --- identify type of same numbers pattern : 2,1,1,1 then select the complete opposite from all the possible patterns : 2,1,1,1 / 3,1,1 / 3,2 / 4,1 / (5) next time do the same however only from the remaining patterns. And after patterns run out start a new round. Check so that the one's, two's, three's from the "meta" patterns do not repeat. 22111 ---> 55555 --> 33311 ---> 33322 (in this example the three's and ones match) in the actual permutations when the pattern is decided as well as the placement of two's three's ... pick the numbers accordingly so there would be the least amount of repetition in their own index. 10321 ---> 00000 ---> 21112 ---> 22233 (for the three two's in the last permutation it is a tie between using number three or two, however for the two three's anything else than three would result in more instances in their indexes) hopefully, it is not too confusing thank you again and sorry for the late response!03/14/20