Compute the prime factors of a given natural number.
A prime number is only evenly divisible by itself and 1.
Note that 1 is not a prime number.
What are the prime factors of 60?
Our successful divisors in that computation represent the list of prime factors of 60: 2, 2, 3, and 5.
You can check this yourself:
2 * 2 * 3 * 5
= 4 * 15
= 60
Success!
One or several of the tests of this exercise have been tagged as :slow
, because they might take a long time to finish. For this reason, they will not be run on the platform by the automated test runner. If you are solving this exercise directly on the platform in the web editor, you might want to consider downloading this exercise to your machine instead. This will allow you to run all the tests and check the efficiency of your solution.
Sign up to Exercism to learn and master Elixir with 57 concepts, 162 exercises, and real human mentoring, all for free.