Prime Factors

Difficulty:
Medium

Tags:
arithmetic

Instructions:
Find all of the prime factors for a given number

Code:
def prime_factors(num)
  ___
end

assert_equal prime_factors(102), [2, 3, 17]
assert_equal prime_factors(896680), [2, 5, 29, 773]
assert_equal prime_factors(42), [2, 3, 7]

Your Solution

Ruby 1.9.3

Back to Problems