Created
March 3, 2018 20:53
-
-
Save lsdr/dba628c4a21d426b87c2f262ef0ede51 to your computer and use it in GitHub Desktop.
Random code challenge scripts and stuff like that
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Enter your code here. Read input from STDIN. Print output to STDOUT | |
require 'prime' | |
def ppn(n) | |
Prime.each(Float::INFINITY).lazy.select do |p| | |
p if p.to_s == p.to_s.reverse | |
end.first(n.to_i) | |
end | |
n = STDIN.read | |
STDOUT.write ppn(n) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment