Skip to content

Instantly share code, notes, and snippets.

@joecannatti
Created April 19, 2011 02:52
Show Gist options
  • Save joecannatti/926725 to your computer and use it in GitHub Desktop.
Save joecannatti/926725 to your computer and use it in GitHub Desktop.
Project Euler 26 in Ruby
require 'prime'
Prime.each(1000).to_a.drop(3).map do |n,c=1|
c += 1 until (((10**c)-1) % n) == 0
{:num => n, :size => c}
end.sort{|a,b| a[:size] <=> b[:size]}.last
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment