Alex S.

asked • 03/10/20

Permutations algorithm maximum difference/contrast


I was wondering what would be the algorithm for permutations with 5 numbers and 4 possible kinds of numbers used and order being important.

To make each iteration as different as possible from all the previous ones with the priority it being more different to the latest iteration. And taking in account of patterns of pairs, threes, fours... at certain indexes. eg. 1st (10001) --- > (21112) ---> (32223) ... (still two identical numbers at the sides and three in the middle. Aswell as only two kinds of numbers used overall )

When I tried to figure it out myself, I came to a conclusion that I need to set what kind of trade-offs to prioritize and what makes a bigger difference. One restriction on top of this would be that there cannot be only zeroes present.

I would greatly appreciate any thoughts on this. thank you !

1 Expert Answer


Ben R. answered • 03/11/20

5 (3)

PhD in Mathematics, 9 years college teaching experience

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!


Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.


Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.