#K94532. Sum of Unique Prime Factors
Sum of Unique Prime Factors
Sum of Unique Prime Factors
You are given a positive integer n. Your task is to compute the sum of its unique prime factors. In other words, if the set of prime factors of n is \(\{p_1, p_2, \ldots, p_k\}\), you must calculate:
\(S(n)=\sum_{i=1}^{k} p_i\)
Note that if n does not have any prime factors (for example, when n = 1), the answer is 0.
The input format is standardized for competitive programming: you will read the input from stdin
and write the output to stdout
.
inputFormat
The first line contains a single integer T, the number of test cases. Each of the following T lines contains a single integer n for which you need to compute the sum of unique prime factors.
Constraints:
- 1 \(\leq T \leq 10^4\)
- 1 \(\leq n \leq 10^9\)
outputFormat
For each test case, output a single line containing the sum of the unique prime factors of n.
## sample5
12
30
1
10
7
5
10
0
7
7
</p>