What are the divisors of 640?
1, 2, 4, 5, 8, 10, 16, 20, 32, 40, 64, 80, 128, 160, 320, 640
- There is a total of 16 positive divisors.
- The sum of these divisors is 1530.
- The arithmetic mean is 95.625.
14 even divisors
2, 4, 8, 10, 16, 20, 32, 40, 64, 80, 128, 160, 320, 640
2 odd divisors
1, 5
How to compute the divisors of 640?
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 640 by each of the numbers from 1 to 640 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 640 / 1 = 640 (the remainder is 0, so 1 is a divisor of 640)
- 640 / 2 = 320 (the remainder is 0, so 2 is a divisor of 640)
- 640 / 3 = 213.33333333333 (the remainder is 1, so 3 is not a divisor of 640)
- ...
- 640 / 639 = 1.0015649452269 (the remainder is 1, so 639 is not a divisor of 640)
- 640 / 640 = 1 (the remainder is 0, so 640 is a divisor of 640)
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 640 (i.e. 25.298221281347). 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 )
- 640 / 1 = 640 (the remainder is 0, so 1 and 640 are divisors of 640)
- 640 / 2 = 320 (the remainder is 0, so 2 and 320 are divisors of 640)
- 640 / 3 = 213.33333333333 (the remainder is 1, so 3 is not a divisor of 640)
- ...
- 640 / 24 = 26.666666666667 (the remainder is 16, so 24 is not a divisor of 640)
- 640 / 25 = 25.6 (the remainder is 15, so 25 is not a divisor of 640)