What are the divisors of 178?
1, 2, 89, 178
- There is a total of 4 positive divisors.
- The sum of these divisors is 270.
- The arithmetic mean is 67.5.
2 even divisors
2, 178
2 odd divisors
1, 89
How to compute the divisors of 178?
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 178 by each of the numbers from 1 to 178 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 178 / 1 = 178 (the remainder is 0, so 1 is a divisor of 178)
- 178 / 2 = 89 (the remainder is 0, so 2 is a divisor of 178)
- 178 / 3 = 59.333333333333 (the remainder is 1, so 3 is not a divisor of 178)
- ...
- 178 / 177 = 1.0056497175141 (the remainder is 1, so 177 is not a divisor of 178)
- 178 / 178 = 1 (the remainder is 0, so 178 is a divisor of 178)
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 178 (i.e. 13.341664064126). 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 )
- 178 / 1 = 178 (the remainder is 0, so 1 and 178 are divisors of 178)
- 178 / 2 = 89 (the remainder is 0, so 2 and 89 are divisors of 178)
- 178 / 3 = 59.333333333333 (the remainder is 1, so 3 is not a divisor of 178)
- ...
- 178 / 12 = 14.833333333333 (the remainder is 10, so 12 is not a divisor of 178)
- 178 / 13 = 13.692307692308 (the remainder is 9, so 13 is not a divisor of 178)