题目描述
Given a natural number n, calculate sum of all its proper divisors. A proper divisor of a natural number is the divisor that is strictly less than the number.
Example 1:
Input: n = 10
Output: 8
Explanation: Proper divisors 1 + 2 + 5 = 8.
Example 2:
Input: n = 6
Output: 6
Explanation: Proper divisors 1 + 2 + 3 = 6.
Your Task:
You dont need to read input or print anything. Complete the function divSum() which takes n as input parameter and returns sum of proper divisors of n.
Expected Time Complexity: O(sqrt(n))
Expected Auxiliary Space: O(1)
Constraints:
2<= n <=10^{6}
输入格式
见题面
输出格式
见题面
样例输入
n = 10
样例输出
8