What are the divisors of 238?
1, 2, 7, 14, 17, 34, 119, 238
- There is a total of 8 positive divisors.
- The sum of these divisors is 432.
- The arithmetic mean is 54.
4 even divisors
2, 14, 34, 238
4 odd divisors
1, 7, 17, 119
How to compute the divisors of 238?
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 238 by each of the numbers from 1 to 238 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 238 / 1 = 238 (the remainder is 0, so 1 is a divisor of 238)
- 238 / 2 = 119 (the remainder is 0, so 2 is a divisor of 238)
- 238 / 3 = 79.333333333333 (the remainder is 1, so 3 is not a divisor of 238)
- ...
- 238 / 237 = 1.0042194092827 (the remainder is 1, so 237 is not a divisor of 238)
- 238 / 238 = 1 (the remainder is 0, so 238 is a divisor of 238)
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 238 (i.e. 15.427248620542). 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 )
- 238 / 1 = 238 (the remainder is 0, so 1 and 238 are divisors of 238)
- 238 / 2 = 119 (the remainder is 0, so 2 and 119 are divisors of 238)
- 238 / 3 = 79.333333333333 (the remainder is 1, so 3 is not a divisor of 238)
- ...
- 238 / 14 = 17 (the remainder is 0, so 14 and 17 are divisors of 238)
- 238 / 15 = 15.866666666667 (the remainder is 13, so 15 is not a divisor of 238)