What are the divisors of 638?
1, 2, 11, 22, 29, 58, 319, 638
- There is a total of 8 positive divisors.
- The sum of these divisors is 1080.
- The arithmetic mean is 135.
4 even divisors
2, 22, 58, 638
4 odd divisors
1, 11, 29, 319
How to compute the divisors of 638?
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 638 by each of the numbers from 1 to 638 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 638 / 1 = 638 (the remainder is 0, so 1 is a divisor of 638)
- 638 / 2 = 319 (the remainder is 0, so 2 is a divisor of 638)
- 638 / 3 = 212.66666666667 (the remainder is 2, so 3 is not a divisor of 638)
- ...
- 638 / 637 = 1.0015698587127 (the remainder is 1, so 637 is not a divisor of 638)
- 638 / 638 = 1 (the remainder is 0, so 638 is a divisor of 638)
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 638 (i.e. 25.25866188063). 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 )
- 638 / 1 = 638 (the remainder is 0, so 1 and 638 are divisors of 638)
- 638 / 2 = 319 (the remainder is 0, so 2 and 319 are divisors of 638)
- 638 / 3 = 212.66666666667 (the remainder is 2, so 3 is not a divisor of 638)
- ...
- 638 / 24 = 26.583333333333 (the remainder is 14, so 24 is not a divisor of 638)
- 638 / 25 = 25.52 (the remainder is 13, so 25 is not a divisor of 638)