Skip to content

Instantly share code, notes, and snippets.

@lune-sta
Created August 22, 2012 17:06
Show Gist options
  • Select an option

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

Select an option

Save lune-sta/3427580 to your computer and use it in GitHub Desktop.
Project Euler 32
p (1000..9999).select{|a|(2..Math::sqrt(a)).select{|b|a % b == 0 && "#{a}#{b}#{a/b}".split(//).sort.join == (1..9).to_a.join}.empty?.!}.inject(0, :+) # 45228
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment