What are the divisors of 518?
1, 2, 7, 14, 37, 74, 259, 518
- There is a total of 8 positive divisors.
- The sum of these divisors is 912.
- The arithmetic mean is 114.
4 even divisors
2, 14, 74, 518
4 odd divisors
1, 7, 37, 259
How to compute the divisors of 518?
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 518 by each of the numbers from 1 to 518 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 518 / 1 = 518 (the remainder is 0, so 1 is a divisor of 518)
- 518 / 2 = 259 (the remainder is 0, so 2 is a divisor of 518)
- 518 / 3 = 172.66666666667 (the remainder is 2, so 3 is not a divisor of 518)
- ...
- 518 / 517 = 1.0019342359768 (the remainder is 1, so 517 is not a divisor of 518)
- 518 / 518 = 1 (the remainder is 0, so 518 is a divisor of 518)
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 518 (i.e. 22.759613353482). 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 )
- 518 / 1 = 518 (the remainder is 0, so 1 and 518 are divisors of 518)
- 518 / 2 = 259 (the remainder is 0, so 2 and 259 are divisors of 518)
- 518 / 3 = 172.66666666667 (the remainder is 2, so 3 is not a divisor of 518)
- ...
- 518 / 21 = 24.666666666667 (the remainder is 14, so 21 is not a divisor of 518)
- 518 / 22 = 23.545454545455 (the remainder is 12, so 22 is not a divisor of 518)