require 'prime' L, H = gets.split.map(&:to_i) i = 2 factor = 0 ans = 0 while i * i <= H (H / i).downto(i){|j| if i * j < L break end tmp = Prime.prime_division(i * j)[0][0] if factor < tmp factor = tmp ans = i * j end if factor > i p ans exit end } i += 1 end p ans