n =gets.split.map(&:to_i) a =[*n[0]..n[1]] a.each{|i| p i if i % 3 == 0 ||i.to_s.include?("3")}