Help! Sum of prime factors challenge

the challenge is to build a function that takes in a number and returns it prime factors sum.
It seems in my output that it is always correct, bot it keeps telling me that I have only 4/5 test cases passed. I tried it deleting multiple factors (like 99=1133-> 14) or leaving it multiple (99=1133->17)
What do you think the problem is? thank you!

The prime factors of 99 are 3 and 11
since 99 = 32 × 11

I’m not sure whether you can use a prime factor more than once.
So maybe it should be 3 + 11 = 14 instead of 3 + 3 + 11 = 17

Additionally, I think the sum of the prime factors for a prime number would just be the prime number.
so sumOfPrimeFactors(13) should return 13.

1 Like

thanks! I changed it so it does that, and it still gives me only 4/5, don’t get why…

Are you checking if all the numbers you are pushing to the array are prime?
What happens for
sumOfPrimeFactors(16) ?
Does it return the appropriate result?
(notice: 16 = 24 )

yes ive modified it, it gives 2 as the sum, but still says 4/5 testcases
thanks…

I don’t know …
the only difference I see from some of the other solutions posted is that
some of the others used a default return that’s 0.
(I guess that would mean returning 0 instead of 'ERROR' for an invalid input.)
But I don’t think that would affect whether any tests are passed.

(I created a function to check whether a number was prime when I did the challenge.)