What are the divisors of 628?
1, 2, 4, 157, 314, 628
- There is a total of 6 positive divisors.
- The sum of these divisors is 1106.
- The arithmetic mean is 184.33333333333.
4 even divisors
2, 4, 314, 628
2 odd divisors
1, 157
How to compute the divisors of 628?
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 628 by each of the numbers from 1 to 628 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 628 / 1 = 628 (the remainder is 0, so 1 is a divisor of 628)
- 628 / 2 = 314 (the remainder is 0, so 2 is a divisor of 628)
- 628 / 3 = 209.33333333333 (the remainder is 1, so 3 is not a divisor of 628)
- ...
- 628 / 627 = 1.0015948963317 (the remainder is 1, so 627 is not a divisor of 628)
- 628 / 628 = 1 (the remainder is 0, so 628 is a divisor of 628)
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 628 (i.e. 25.059928172283). 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 )
- 628 / 1 = 628 (the remainder is 0, so 1 and 628 are divisors of 628)
- 628 / 2 = 314 (the remainder is 0, so 2 and 314 are divisors of 628)
- 628 / 3 = 209.33333333333 (the remainder is 1, so 3 is not a divisor of 628)
- ...
- 628 / 24 = 26.166666666667 (the remainder is 4, so 24 is not a divisor of 628)
- 628 / 25 = 25.12 (the remainder is 3, so 25 is not a divisor of 628)