README.md (1156B) - raw
1 # Prime Factors 2 3 Welcome to Prime Factors on Exercism's Perl 5 Track. 4 If you need help running the tests or submitting your code, check out `HELP.md`. 5 6 ## Instructions 7 8 Compute the prime factors of a given natural number. 9 10 A prime number is only evenly divisible by itself and 1. 11 12 Note that 1 is not a prime number. 13 14 ## Example 15 16 What are the prime factors of 60? 17 18 - Our first divisor is 2. 2 goes into 60, leaving 30. 19 - 2 goes into 30, leaving 15. 20 - 2 doesn't go cleanly into 15. So let's move on to our next divisor, 3. 21 - 3 goes cleanly into 15, leaving 5. 22 - 3 does not go cleanly into 5. The next possible factor is 4. 23 - 4 does not go cleanly into 5. The next possible factor is 5. 24 - 5 does go cleanly into 5. 25 - We're left only with 1, so now, we're done. 26 27 Our successful divisors in that computation represent the list of prime 28 factors of 60: 2, 2, 3, and 5. 29 30 You can check this yourself: 31 32 - 2 \* 2 \* 3 * 5 33 - = 4 * 15 34 - = 60 35 - Success! 36 37 ## Source 38 39 ### Created by 40 41 - @szabgab 42 43 ### Contributed to by 44 45 - @kytrinyx 46 - @m-dango 47 - @rfilipo 48 49 ### Based on 50 51 The Prime Factors Kata by Uncle Bob - http://butunclebob.com/ArticleS.UncleBob.ThePrimeFactorsKata