Implements xkcd 1017