https://qiita.com/daddygongon/items/ba94b0f2a73990fc6a07
Find the first prime number of 10 consecutive digits of e (base of natural logarithm) with ruby. However, e (base of natural logarithm) is up to 200 digits.
def prime?(num)
return true if num<=3
(2..Math.sqrt(num)).each do |i|
return false if num % i == 0
end
return true
end
instring = gets.to_s.chop
(2..instring.length-2-10).each do |i|
num = instring[i..i+10-1].to_i
if prime?(num)
puts "#{num} is first 10 digit prime."
break
end
end
2.7182818284590452353602874713526624977572470936999595749669676277240766303535475945713821785251664274274663919320030599218174135966290435729003342952605956307381323286279434907632338298807531952510190
$ ruby google_recruit.rb < google_recruit_in.txt
7427466391 is first 10 digit prime.