#C13632. Prime Factor Sum

    ID: 43192 Type: Default 1000ms 256MiB

Prime Factor Sum

Prime Factor Sum

In this problem, you are given a list of positive integers. For each integer, compute the sum of its prime factors. Note that if a prime factor appears multiple times in the factorization, it should be counted each time. For example, consider the number 12. Its prime factorization is (2^2 \times 3), so the sum of its prime factors is (2+2+3=7).

The overall task is to compute the sum of these individual sums for the entire list. For instance, for the input list [6, 28, 15]:

  • 6 = 2 \(\times\) 3, sum = 2+3 = 5
  • 28 = 2 \(\times\) 2 \(\times\) 7, sum = 2+2+7 = 11
  • 15 = 3 \(\times\) 5, sum = 3+5 = 8
The final answer is \(5+11+8=24\).

inputFormat

The input is read from standard input (stdin). The first line contains a single integer (N), representing the number of integers. The second line contains (N) space-separated positive integers.

outputFormat

Output a single integer to standard output (stdout): the sum of the sums of the prime factors for each of the input integers.## sample

3
6 28 15
24

</p>