Problem 4 (written in Ruby)
max, fa, fb = 0, 0, 0
(100..999).each do |a|
(100..999).each do |b|
s = (a*b).to_s
if s[0..s.length/2] == s[s.length/2..-1].reverse then
max = a*b if max < a*b
fa, fb = a, b
end
end
endputs "#{max} = #{fa} * #{fb}"
Problem:
http://odz.sakura.ne.jp/projecteuler/index.php?Problem%204