Inspired by digital roots, the prime factoral root of a number is the number that emerges when you take the prime factors of a number, add them together, and repeat the process on the resulting number, continuing until you end up with a prime number (which has itself as its only prime factor, and is thus its own prime factoral root). The prime factoral root of 4 is 4, as 2*2=2+2, and this is the only non-prime prime factoral root of an integer greater than 1 (which is another special case, as it has no prime factors). The OEIS sequence formed by prime factoral roots is A029908.
For example, the prime factoral root of 24 is:
24=2*2*2*3
2+2+2+3=9=3*3
3+3=6=2*3
2+3=5, and the only prime factor of 5 is 5. Therefore, the prime factoral root of 24 is 5.
Your Task:
Write a program or function that finds the prime factoral root of an input integer.
Input:
An integer, input through any reasonable method, between 2 and the largest integer your language will support (inclusive). Specifically choosing a language that has an unreasonably low maximum integer size is not allowed (and also violates this standard loophole)
Output:
An integer, the prime factoral root of the input.
Test Cases:
4 -> 4
24 -> 5
11 -> 11
250 -> 17
Scoring:
This is code-golf, lowest score in bytes wins!
4
in the test cases, since it's an exception and it's easy to forget about it while testing an answer? \$\endgroup\$