Everybody loves palindromes, right? I do, at least. That’s why I was excited
when I learned that every number can be a palindrome when it’s written in the
appropriate base. There is a trivial proof for this property: any number N > 3
is a palindrome in base N-1 because it may be written “11”. So here is my
solution, in Haskell, to this CodeChef
problem, that finds the smallest base
that makes any given number a palindrome.
This is certainly not the fastest solution possible. Indeed it is downright
naive. But hopefully the logic is clear.