What are the divisors of 516?
1, 2, 3, 4, 6, 12, 43, 86, 129, 172, 258, 516
- There is a total of 12 positive divisors.
- The sum of these divisors is 1232.
- The arithmetic mean is 102.66666666667.
8 even divisors
2, 4, 6, 12, 86, 172, 258, 516
4 odd divisors
1, 3, 43, 129
How to compute the divisors of 516?
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 516 by each of the numbers from 1 to 516 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 516 / 1 = 516 (the remainder is 0, so 1 is a divisor of 516)
- 516 / 2 = 258 (the remainder is 0, so 2 is a divisor of 516)
- 516 / 3 = 172 (the remainder is 0, so 3 is a divisor of 516)
- ...
- 516 / 515 = 1.0019417475728 (the remainder is 1, so 515 is not a divisor of 516)
- 516 / 516 = 1 (the remainder is 0, so 516 is a divisor of 516)
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 516 (i.e. 22.715633383201). 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 )
- 516 / 1 = 516 (the remainder is 0, so 1 and 516 are divisors of 516)
- 516 / 2 = 258 (the remainder is 0, so 2 and 258 are divisors of 516)
- 516 / 3 = 172 (the remainder is 0, so 3 and 172 are divisors of 516)
- ...
- 516 / 21 = 24.571428571429 (the remainder is 12, so 21 is not a divisor of 516)
- 516 / 22 = 23.454545454545 (the remainder is 10, so 22 is not a divisor of 516)