I am looking for a way to map permutation with repetitions written in big array (for example with million elemenths) to an index written in other array. Every element in array can have values from 0 to 255. How to achieve that?
Example (not calculated):
Perm={4,67,23,33,45,23,255,234,67,99,67} => Index={34,23,44,23,23,7,254}
Perm={4,67,23,33,45,23,255,234,67,99,68} => Index={34,23,44,23,23,7,255}
Perm={4,67,23,33,45,23,255,234,67,99,69} => Index={34,23,44,23,23,8,0}
etc.