Skip to content

Instantly share code, notes, and snippets.

@lune-sta
Created August 24, 2012 11:37
Show Gist options
  • Select an option

  • Save lune-sta/3449539 to your computer and use it in GitHub Desktop.

Select an option

Save lune-sta/3449539 to your computer and use it in GitHub Desktop.
Project Euler 37
require 'prime'
p Prime.each.lazy.select{|a|a>7&&(1...a.to_s.size).map{|b|[a.to_s[0,b],a.to_s.split(//).reverse.join[0,b].split(//).reverse.join]}.flatten.all?{|b|b.to_i.prime?}}.take(11).inject(:+)
# 748317 (ruby2.0.0dev)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment