I had originally done some of these a several years ago, but a hard drive failure later, thought I might do some again only this time in python instead of C.
Usually do brute force first and then try to find a better solution, whether my own or someone else's from board discussion or blogs where noted.