Skip to content

Instantly share code, notes, and snippets.

@lsdr
Created March 3, 2018 20:53
Show Gist options
  • Save lsdr/dba628c4a21d426b87c2f262ef0ede51 to your computer and use it in GitHub Desktop.
Save lsdr/dba628c4a21d426b87c2f262ef0ede51 to your computer and use it in GitHub Desktop.
Random code challenge scripts and stuff like that
# 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