some related euler problems in ruby