What are the divisors of 5128?
1, 2, 4, 8, 641, 1282, 2564, 5128
- There is a total of 8 positive divisors.
- The sum of these divisors is 9630.
- The arithmetic mean is 1203.75.
6 even divisors
2, 4, 8, 1282, 2564, 5128
2 odd divisors
1, 641
How to compute the divisors of 5128?
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 5128 by each of the numbers from 1 to 5128 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 5128 / 1 = 5128 (the remainder is 0, so 1 is a divisor of 5128)
- 5128 / 2 = 2564 (the remainder is 0, so 2 is a divisor of 5128)
- 5128 / 3 = 1709.3333333333 (the remainder is 1, so 3 is not a divisor of 5128)
- ...
- 5128 / 5127 = 1.0001950458358 (the remainder is 1, so 5127 is not a divisor of 5128)
- 5128 / 5128 = 1 (the remainder is 0, so 5128 is a divisor of 5128)
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 5128 (i.e. 71.610055159873). 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 )
- 5128 / 1 = 5128 (the remainder is 0, so 1 and 5128 are divisors of 5128)
- 5128 / 2 = 2564 (the remainder is 0, so 2 and 2564 are divisors of 5128)
- 5128 / 3 = 1709.3333333333 (the remainder is 1, so 3 is not a divisor of 5128)
- ...
- 5128 / 70 = 73.257142857143 (the remainder is 18, so 70 is not a divisor of 5128)
- 5128 / 71 = 72.225352112676 (the remainder is 16, so 71 is not a divisor of 5128)