'jgrahamc posted a Perl implementation of Alan Turing's method which made HN a couple of times [0], [1]. This is much better than brute force. For something a little more accessible on mobile, I made this [2] at the time based on his Perl implementation.