require 'prime' N = gets.to_i puts ((N - 100)..(N + 100)).find { |n| next if n == 1 !n.prime? }