Skip to content

Instantly share code, notes, and snippets.

@MiSawa
Created August 18, 2012 17:29
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 MiSawa/3388569 to your computer and use it in GitHub Desktop.
Save MiSawa/3388569 to your computer and use it in GitHub Desktop.
require "prime"
mx = 1000
res = [0, 0, 0]
for b in -mx+1...mx
next unless b.prime?
for a in -mx+1...mx
l = 0
l += 1 while (l*l + a*l + b).prime?
res = [res, [l, a, b]].max
end
end
p res[1..-1].inject(:*)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment