Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'mathn'
- def calculate
- m, p = 600851475143, Prime.new
- until m == 1
- np = p.next
- if m % np == 0
- m = m / np
- end
- end
- return np
- end
- start = Time.now
- puts "Answer: #{calculate}\nThat took #{Time.now-start} seconds"
Add Comment
Please, Sign In to add comment