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.
Input: n = 10
Explanation: Proper divisors 1 + 2 + 5 = 8.
Input: n = 6
Explanation: Proper divisors 1 + 2 + 3 = 6.
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)
2<= n <=106
We strongly recommend solving this problem on your own before viewing its editorial. Do you still
want to view the editorial?
Login to access your submissions.