Suppose I have 5 numbers: 1,7,13,5,6. I want to perform some kind of algorithm that allows me to derive a number such that if any of those numbers changed in value or switched in order that I would get a different aggregate.
The aggregate must be unique. In other words the only way to get that aggregate is using exactly those 5 numbers in that exact order.
I have something that is passing all my initial testing but would love to have other people weight in.
Proposed: 1^2 + 1^2 + 7^2 + 2^2 + 13 ^ 2 + 3 ^ 2 + 5^2 + 4 ^2 + 6 ^ 2 + 5 ^ 2
Explanation: I square the number add that to the square of the position it is in the list and then accumulate a grand total.
Bonus: Provided that the proposed solution does work. Any solution that would produce a smaller number or require less operations would be fantastic.