Miscellaneous algorithmic mathy type things I do