euler/euler004.rb

16 lines
259 B
Ruby

require_relative 'euler'
def products_of_three_digits
products = []
(100..999).each do |i|
(100..999).each do |j|
products << i*j
end
end
products
end
def solution
products_of_three_digits.select { |x| Euler.palindrome?(x) }.max
end