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