What are the divisors of 135?
1, 3, 5, 9, 15, 27, 45, 135
- There is a total of 8 positive divisors.
- The sum of these divisors is 240.
- The arithmetic mean is 30.
8 odd divisors
1, 3, 5, 9, 15, 27, 45, 135
How to compute the divisors of 135?
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 135 by each of the numbers from 1 to 135 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 135 / 1 = 135 (the remainder is 0, so 1 is a divisor of 135)
- 135 / 2 = 67.5 (the remainder is 1, so 2 is not a divisor of 135)
- 135 / 3 = 45 (the remainder is 0, so 3 is a divisor of 135)
- ...
- 135 / 134 = 1.0074626865672 (the remainder is 1, so 134 is not a divisor of 135)
- 135 / 135 = 1 (the remainder is 0, so 135 is a divisor of 135)
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 135 (i.e. 11.618950038622). 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 )
- 135 / 1 = 135 (the remainder is 0, so 1 and 135 are divisors of 135)
- 135 / 2 = 67.5 (the remainder is 1, so 2 is not a divisor of 135)
- 135 / 3 = 45 (the remainder is 0, so 3 and 45 are divisors of 135)
- ...
- 135 / 10 = 13.5 (the remainder is 5, so 10 is not a divisor of 135)
- 135 / 11 = 12.272727272727 (the remainder is 3, so 11 is not a divisor of 135)