/ Published in: Ruby
Expand |
Embed | Plain Text
#!/usr/bin/ruby n = 600851475143 while(n > 1) factor = (2..n).find {|x| n % x == 0} puts factor n = n / factor end
You need to login to post a comment.
#!/usr/bin/ruby n = 600851475143 while(n > 1) factor = (2..n).find {|x| n % x == 0} puts factor n = n / factor end
You need to login to post a comment.