Update factor.rb

I like your solution to the prime factors.  Elegant.  But could be made faster and using tail call.