What are the divisors of 189?
1, 3, 7, 9, 21, 27, 63, 189
- There is a total of 8 positive divisors.
- The sum of these divisors is 320.
- The arithmetic mean is 40.
8 odd divisors
1, 3, 7, 9, 21, 27, 63, 189
How to compute the divisors of 189?
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 189 by each of the numbers from 1 to 189 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 189 / 1 = 189 (the remainder is 0, so 1 is a divisor of 189)
- 189 / 2 = 94.5 (the remainder is 1, so 2 is not a divisor of 189)
- 189 / 3 = 63 (the remainder is 0, so 3 is a divisor of 189)
- ...
- 189 / 188 = 1.0053191489362 (the remainder is 1, so 188 is not a divisor of 189)
- 189 / 189 = 1 (the remainder is 0, so 189 is a divisor of 189)
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 189 (i.e. 13.747727084868). 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 )
- 189 / 1 = 189 (the remainder is 0, so 1 and 189 are divisors of 189)
- 189 / 2 = 94.5 (the remainder is 1, so 2 is not a divisor of 189)
- 189 / 3 = 63 (the remainder is 0, so 3 and 63 are divisors of 189)
- ...
- 189 / 12 = 15.75 (the remainder is 9, so 12 is not a divisor of 189)
- 189 / 13 = 14.538461538462 (the remainder is 7, so 13 is not a divisor of 189)