Sum of Distinct Prime Divisors
Problem statement
Given a positive integer n, return the sum of its distinct prime divisors.
Each prime divisor contributes once, regardless of its exponent in the factorization. For n = 1, return 0.
Function
sumDistinctPrimeDivisors(n: long) → longExamples
Example 1
n = 12return = 5The distinct prime divisors of 12 are 2 and 3, whose sum is 5.
Example 2
n = 13return = 13Because 13 is prime, it is its only prime divisor.
Constraints
1 <= n <= 10^12