What are the divisors of 58?
1, 2, 29, 58
- There is a total of 4 positive divisors.
- The sum of these divisors is 90.
- The arithmetic mean is 22.5.
2 even divisors
2, 58
2 odd divisors
1, 29
How to compute the divisors of 58?
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 58 by each of the numbers from 1 to 58 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 58 / 1 = 58 (the remainder is 0, so 1 is a divisor of 58)
- 58 / 2 = 29 (the remainder is 0, so 2 is a divisor of 58)
- 58 / 3 = 19.333333333333 (the remainder is 1, so 3 is not a divisor of 58)
- ...
- 58 / 57 = 1.0175438596491 (the remainder is 1, so 57 is not a divisor of 58)
- 58 / 58 = 1 (the remainder is 0, so 58 is a divisor of 58)
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 58 (i.e. 7.6157731058639). 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 )
- 58 / 1 = 58 (the remainder is 0, so 1 and 58 are divisors of 58)
- 58 / 2 = 29 (the remainder is 0, so 2 and 29 are divisors of 58)
- 58 / 3 = 19.333333333333 (the remainder is 1, so 3 is not a divisor of 58)
- ...
- 58 / 6 = 9.6666666666667 (the remainder is 4, so 6 is not a divisor of 58)
- 58 / 7 = 8.2857142857143 (the remainder is 2, so 7 is not a divisor of 58)