I have a list of n objects
say [ apple, orange, carrot, cherry, banana ]
Now I am trying to come up with an equation which will generate an unique number for each combinations from this list.
eg :
say I assign following values for each items
apple = 1
orange = 2
carrot = 3
cherry = 4
banana = 5
If I directly add the individual values to generate combination score then the values will be
apple = 1
apple, carrot = 4
apple, orange = 3
But here multiple combination can have same scores.
I need to generate an equation which will generate UNIQUE score for all of these combination.
POSITION IS NOT AN ISSUE.
Score(apple,orange,carrot) = Score(carrot, apple, orange) = Score (orange, apple, carrot)
But Score (apple, carrot) $\ne$ Score(cherry)
How this can be generated ?
Assign a prime number to each object.
Let the score for each combination be the product of the prime numbers assigned to the objects in the combination.
This will also allow you to use the score to record multiple occurrences of items (if you want).
Every such score created can be uniquely factorised to identify the items in your list.