What are the divisors of 5678?
1, 2, 17, 34, 167, 334, 2839, 5678
- There is a total of 8 positive divisors.
- The sum of these divisors is 9072.
- The arithmetic mean is 1134.
4 even divisors
2, 34, 334, 5678
4 odd divisors
1, 17, 167, 2839
How to compute the divisors of 5678?
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 5678 by each of the numbers from 1 to 5678 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 5678 / 1 = 5678 (the remainder is 0, so 1 is a divisor of 5678)
- 5678 / 2 = 2839 (the remainder is 0, so 2 is a divisor of 5678)
- 5678 / 3 = 1892.6666666667 (the remainder is 2, so 3 is not a divisor of 5678)
- ...
- 5678 / 5677 = 1.0001761493747 (the remainder is 1, so 5677 is not a divisor of 5678)
- 5678 / 5678 = 1 (the remainder is 0, so 5678 is a divisor of 5678)
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 5678 (i.e. 75.352504935138). 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 )
- 5678 / 1 = 5678 (the remainder is 0, so 1 and 5678 are divisors of 5678)
- 5678 / 2 = 2839 (the remainder is 0, so 2 and 2839 are divisors of 5678)
- 5678 / 3 = 1892.6666666667 (the remainder is 2, so 3 is not a divisor of 5678)
- ...
- 5678 / 74 = 76.72972972973 (the remainder is 54, so 74 is not a divisor of 5678)
- 5678 / 75 = 75.706666666667 (the remainder is 53, so 75 is not a divisor of 5678)