Skip to content

Instantly share code, notes, and snippets.

@ShikChen
Created August 21, 2016 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ShikChen/21dc3e2301bdd73db591cc25576d7f02 to your computer and use it in GitHub Desktop.
Save ShikChen/21dc3e2301bdd73db591cc25576d7f02 to your computer and use it in GitHub Desktop.
require 'openssl'
n = 100000
m = (n ** 0.5).ceil
p = 100000.downto(0).lazy.select{|i| i.to_bn.prime?}.first(m)
puts n
puts p.product(p).take(n).map{|x, y| x * y}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment