What are the divisors of 542?
1, 2, 271, 542
- There is a total of 4 positive divisors.
- The sum of these divisors is 816.
- The arithmetic mean is 204.
2 even divisors
2, 542
2 odd divisors
1, 271
How to compute the divisors of 542?
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 542 by each of the numbers from 1 to 542 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 542 / 1 = 542 (the remainder is 0, so 1 is a divisor of 542)
- 542 / 2 = 271 (the remainder is 0, so 2 is a divisor of 542)
- 542 / 3 = 180.66666666667 (the remainder is 2, so 3 is not a divisor of 542)
- ...
- 542 / 541 = 1.0018484288355 (the remainder is 1, so 541 is not a divisor of 542)
- 542 / 542 = 1 (the remainder is 0, so 542 is a divisor of 542)
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 542 (i.e. 23.280893453646). 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 )
- 542 / 1 = 542 (the remainder is 0, so 1 and 542 are divisors of 542)
- 542 / 2 = 271 (the remainder is 0, so 2 and 271 are divisors of 542)
- 542 / 3 = 180.66666666667 (the remainder is 2, so 3 is not a divisor of 542)
- ...
- 542 / 22 = 24.636363636364 (the remainder is 14, so 22 is not a divisor of 542)
- 542 / 23 = 23.565217391304 (the remainder is 13, so 23 is not a divisor of 542)