One day Helder showed me Project Euler, a collection of interesting math problems to be solved using computer programs.
I took a look at the first problem: find the sum of all the multiples of 3 or 5 below 1000. Getting the linear time solution was trivial, the constant time solution was also not hard. However, I could not help it, I continued by applying some obfuscation voodoo and came up with this answer (of course, constant time as well):
return "uncopyrightable"[n % 15] - 'a' + 44 - "xzoxy}pge]_LAKD"[n% 15] + 'A' - (!(n % 15)) * 9 + 15 * ((n / 15) * (4 + ("aaabbcdddeffggg"[n % 15] - 'a')) + (n / 15) * (n / 15 - 1) * 7 / 2);
How did a word (“uncopyrightable”) end up in that solution? Believe me, it was (a lot of) fun! 🙂