P19791 [GeeksforGeeks] Factors sum2016
普及-
题目描述

Given a number N, find the sum of all its factors.
Example 1:
Input: N = 30
Output: 72
Explanation: Factors sum 1 + 2 + 3 + 5
+ 6 + 10 + 15 + 30 = 72
Example 2:
Input: N = 15
Output: 24
Explanation: Factors sum 1 + 3 + 5
+ 15 = 24
Your Task:
You don't need to read input or print anything. Your task is to complete the function factorSum() which takes N as input and returns the sum.
Expected Time Complexity: O(sqrt N)
Expected Auxiliary Space: O(1)
Constraints:
1 ≤ N ≤ 10^{9}

输入格式

见题面

输出格式

见题面

样例输入
N = 30
样例输出
72