AmazonOA #349
Sum of All Days Numbers on Which the Data of the Xth Will Be Dependent
Estimated MediumJudge-ready
Topics (AI-labelled)Bits & Math
Given n, a value x belongs to the dependency ID set if some positive integer k satisfies floor(n/k)=x. Find the sum of all distinct x in this set, counting each value only once; 0 also belongs to the set but contributes 0.
Input
The input is an integer n. On this site 0≤n≤10^12.
Output
Output a single integer, the answer.
Example 1
Input:
5
Output:
8
Example 2
Input:
0
Output:
0
Example 3
Input:
16
Output:
39
Example notes
The outputs of the three public examples are 8; 0; and 39, checked by independent enumeration or direct simulation.
Editorial
Loading solution…