Number with all permutations between any 2 digits
Lets say you are given a set of n consecutive digits , Ex {0,1,2,3}. You are required to form a number using the digits which abides by the following rule:
1.The number should cover all relations (ex 12 and 21) between any 2 digits from the set of numbers
For the given set this number would be :0123130203210 or 0123021310320.
I was able to get this number manually by trial and error. Is there a deterministic way of achieving this number for any n consecutive digits?
The number will have all the 2 digit permutations only once.
0 > [1,2,3] will yield 01 , 02 , 03
1 > [0,2,3] will yield 10 , 12 , 13
2 > [0,1,3] will yield 20 , 21 , 23
3 > [0,1,2] will yield 30 , 31 , 32
We have to generate a number which will cover all the above relations.
Last fiddled with by sticky on 20201124 at 08:04
