solved, but too slow

One possible improvement:
keep a list of which terms terminated in less than 60 iterations (and
how long it took for them to terminate), and if we encounter these
terms while running chain_length(), we can do a quick calc and possibly
terminate early