What are the divisors of 34?
1, 2, 17, 34
- There is a total of 4 positive divisors.
- The sum of these divisors is 54.
- The arithmetic mean is 13.5.
2 even divisors
2, 34
2 odd divisors
1, 17
How to compute the divisors of 34?
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 34 by each of the numbers from 1 to 34 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 34 / 1 = 34 (the remainder is 0, so 1 is a divisor of 34)
- 34 / 2 = 17 (the remainder is 0, so 2 is a divisor of 34)
- 34 / 3 = 11.333333333333 (the remainder is 1, so 3 is not a divisor of 34)
- ...
- 34 / 33 = 1.030303030303 (the remainder is 1, so 33 is not a divisor of 34)
- 34 / 34 = 1 (the remainder is 0, so 34 is a divisor of 34)
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 34 (i.e. 5.8309518948453). 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 )
- 34 / 1 = 34 (the remainder is 0, so 1 and 34 are divisors of 34)
- 34 / 2 = 17 (the remainder is 0, so 2 and 17 are divisors of 34)
- 34 / 3 = 11.333333333333 (the remainder is 1, so 3 is not a divisor of 34)
- ...
- 34 / 4 = 8.5 (the remainder is 2, so 4 is not a divisor of 34)
- 34 / 5 = 6.8 (the remainder is 4, so 5 is not a divisor of 34)