Retired
Sum of Prime Factors (retired)
Description:
Prime Factorization
, there exists an unqiue prime factorization such that:
n = (p1^k1)(p2^k2)(p3^k3)...
Task
Given a positive integer n, create a function, perform the following procedure:
Factor n into its prime factors and calculate the sum of these factors.
Take the resulting sum and factor it into its prime factors, then compute the sum again.
Repeat this process until the result is a single prime number.
Example
sum_of_prime_factors(30) : (2)(3)(5) -> sum_of_prime_factors(2+3+5) : (2)(5) -> sum_of_prime_factors(2+5) : 7
# should return 7
sum_of_prime_factors(18) : (2)(3^2) -> sum_of_prime_factors(2+3) : 5 # The powers of prime numbers should be ignored.
# should return 5
sum_of_prime_factors(314159) : 314159
# should return 314159
Input/Output
Type of input :
int
Range :
Mathematics
Similar Kata:
Stats:
Created | Aug 18, 2024 |
Warriors Trained | 16 |
Total Skips | 0 |
Total Code Submissions | 21 |
Total Times Completed | 12 |
Python Completions | 12 |
Total Stars | 0 |
% of votes with a positive feedback rating | 42% of 6 |
Total "Very Satisfied" Votes | 0 |
Total "Somewhat Satisfied" Votes | 5 |
Total "Not Satisfied" Votes | 1 |
Total Rank Assessments | 8 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |