about | help | code help+videos | done | prefs |
Write a method that recursively determines the "ultimate" sum of the prime factors of 'num'. What makes it "ultimate" is that you do not stop until the answer itself is a prime number. For example, if 'num' is 16, the sum of the prime factors of 16 is 8 (2+2+2+2), but 8 is NOT prime, so now you need to find the sum of the prime factors of 8, which is 6 (2+2+2). But 6 is not prime, so you need to find the sum of the prime factors of 6, which is 5 (2+3). Since 5 is a prime number you are done! so the result for 16 is 5. Look at the test data for further examples. mar11_2016_BONUS_sumFactorsPrime(4165) → 7 mar11_2016_BONUS_sumFactorsPrime(595) → 29 mar11_2016_BONUS_sumFactorsPrime(273) → 23 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 290
Copyright Nick Parlante 2017 - privacy