#K58047. Sum of Prime Divisors
Sum of Prime Divisors
Sum of Prime Divisors
You are given a sequence of positive integers. For each integer ( n ), compute the sum of its distinct prime divisors. In other words, if the prime factorization of ( n ) is given by ( n = p_1^{a_1} p_2^{a_2} \cdots p_k^{a_k} ), then output ( p_1 + p_2 + \cdots + p_k ). Note that if ( n = 1 ), which has no prime factors, the output should be 0. For a prime number ( n ), the answer is ( n ) itself.
The input is provided via standard input and the output should be printed to standard output.
inputFormat
The first line contains an integer ( n ), representing the number of elements in the sequence. The second line contains ( n ) space-separated positive integers.
outputFormat
Output a single line with ( n ) space-separated integers, where each integer is the sum of the distinct prime divisors of the corresponding input number.## sample
5
10 12 15 17 18
7 5 8 17 5
</p>