Sum of divisors

Write a function that returns the sum of the divisors of a number @n@.

For instance, the sum of the divisors of 28 is 1+2+4+7+14+28=561+2+4+7+14+28 = 56.

Interface

C++,C
int sum_divisors(int x);
Java
public static int sumDivisors(int x);
Python
sum_divisors(x)  # returns int
sum_divisors(x: int) -> int

Precondition

11 \le @n@ 108\le 10^8.

Observation

You only need to submit the required procedure; your main program will be ignored.

Problem information

Author: Unknown
Translator: Salvador Roura

Generation: 2026-01-25T12:09:11.932Z

© Jutge.org, 2006–2026.
https://jutge.org