projecteuler.net solved in ruby