Python code to solve xkcd 1313 by Peter Norvig | Hacker News Reader