Just a fun Puzzle:
My (fictive) friend told me his PIN: "My PIN is the highest 4 digit number that has the highest sum of unique differences."
He explained: "my PIN consists of 4 numbers A B C D.
- Calculate the absolute differences between A and B, A and C, A and D, B and C, B and D, C and D (so all differences)
- Remove duplicates (so each difference is included only once)
- Add the remaining differences together.
My PIN is the 4 digit number where this count is the highest and the highest of those numbers. "
What is my (fictive) friend's PIN?
Example:
The number 1469 has a count of:
1 ) calculate the differences: $ |1-4| = 3, |1-6| = 5, |1-9| = 8, |4-6| = 2, |4-9| = 5, |6-9| = 3 $
2) remove the duplicates: $ 3, 5, 8, 2 $
3) add them together: $ 18$
So if there is no 4 digit number with a count higher than 18 and 1469 is the highest number of these numbers then 1469 is my friend's pin. (but as I know both conditions are not met)
What is my friend's PIN?
In your answer please describe how you found his PIN (a clever way, or just brute force?)