solving project euler using ruby