Let's not even get into how I might have wound up here, since the truth would probably drive you mad and I couldn't bear to lie. Let's just leave that since arriving there—somehow—last night I've been tinkering with a solution to it that I still don't really think can be right but which I went ahead and implemented twice anyway (once in Python and once in Haskell). The idea being that the reshuffled keys will form one or more cycles, and when different letters of the person's name fall in different cycles, the original name will pop out again after a number of iterations equal to the least common multiple of the lengths of cycles. So that one wants to find some number n of cycles, 1 ≤ n ≤26, such that the sum of the lengths of the cycles is less than or equal to 26 and the lcm of the lengths of the cycles is maximized. And that one can discover this by partitioning 26, etc.
I continue to be suspicious of this because the uploaded programs claim that after you've got four unique letters in your name, increasing the number of unique letters doesn't make you worse off.
Comments