What are the divisors of 511?
1, 7, 73, 511
- There is a total of 4 positive divisors.
- The sum of these divisors is 592.
- The arithmetic mean is 148.
4 odd divisors
1, 7, 73, 511
How to compute the divisors of 511?
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 511 by each of the numbers from 1 to 511 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 511 / 1 = 511 (the remainder is 0, so 1 is a divisor of 511)
- 511 / 2 = 255.5 (the remainder is 1, so 2 is not a divisor of 511)
- 511 / 3 = 170.33333333333 (the remainder is 1, so 3 is not a divisor of 511)
- ...
- 511 / 510 = 1.0019607843137 (the remainder is 1, so 510 is not a divisor of 511)
- 511 / 511 = 1 (the remainder is 0, so 511 is a divisor of 511)
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 511 (i.e. 22.605309110915). 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 )
- 511 / 1 = 511 (the remainder is 0, so 1 and 511 are divisors of 511)
- 511 / 2 = 255.5 (the remainder is 1, so 2 is not a divisor of 511)
- 511 / 3 = 170.33333333333 (the remainder is 1, so 3 is not a divisor of 511)
- ...
- 511 / 21 = 24.333333333333 (the remainder is 7, so 21 is not a divisor of 511)
- 511 / 22 = 23.227272727273 (the remainder is 5, so 22 is not a divisor of 511)