Apr 08
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit numbers.
My solution in Ruby:
var = 0 999.downto(100) { |i| 999.downto(100) { |j| prod = i * j var = [var, prod].max if prod.to_s == prod.to_s.reverse } } puts "Maximum palindrome is #{var}."