Lots of algorithms in Ruby