What are the divisors of 5102?
1, 2, 2551, 5102
- There is a total of 4 positive divisors.
- The sum of these divisors is 7656.
- The arithmetic mean is 1914.
2 even divisors
2, 5102
2 odd divisors
1, 2551
How to compute the divisors of 5102?
A number N is said to be divisible by a number M (with M non-zero) if, when we divide N by M, the remainder of the division is zero.
Brute force algorithm
We could start by using a brute-force method which would involve dividing 5102 by each of the numbers from 1 to 5102 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 5102 / 1 = 5102 (the remainder is 0, so 1 is a divisor of 5102)
- 5102 / 2 = 2551 (the remainder is 0, so 2 is a divisor of 5102)
- 5102 / 3 = 1700.6666666667 (the remainder is 2, so 3 is not a divisor of 5102)
- ...
- 5102 / 5101 = 1.0001960399922 (the remainder is 1, so 5101 is not a divisor of 5102)
- 5102 / 5102 = 1 (the remainder is 0, so 5102 is a divisor of 5102)
Improved algorithm using square-root
However, there is another slightly better approach that reduces the number of iterations by testing only integers less than or equal to the square root of 5102 (i.e. 71.428285713714). Indeed, if a number N has a divisor D greater than its square root, then there is necessarily a smaller divisor d such that:
(thus, if , then )
- 5102 / 1 = 5102 (the remainder is 0, so 1 and 5102 are divisors of 5102)
- 5102 / 2 = 2551 (the remainder is 0, so 2 and 2551 are divisors of 5102)
- 5102 / 3 = 1700.6666666667 (the remainder is 2, so 3 is not a divisor of 5102)
- ...
- 5102 / 70 = 72.885714285714 (the remainder is 62, so 70 is not a divisor of 5102)
- 5102 / 71 = 71.859154929577 (the remainder is 61, so 71 is not a divisor of 5102)