AmazonOA #194
Get Data Dependence Sum (Fungible :)
Estimated MediumJudge-ready
Topics (AI-labelled)Bits & Math
Given n, collect every distinct x with 0≤x<n for which some positive integer k satisfies floor(n/k)=x, and find their sum. The original snapshot explicitly requires x<n, so the value n produced by k=1 must be excluded; 0 belongs to the set but does not affect the sum.
Input
One line containing an integer n, 1≤n≤10^10.
Output
Output a single integer, the answer.
Example 1
Input:
1
Output:
0
Example 2
Input:
5
Output:
3
Example 3
Input:
10
Output:
11
Example notes
The answers are 0; 1+2=3; 1+2+3+5=11.
Editorial
Loading solution…