What are the divisors of 786?
1, 2, 3, 6, 131, 262, 393, 786
- There is a total of 8 positive divisors.
- The sum of these divisors is 1584.
- The arithmetic mean is 198.
4 even divisors
2, 6, 262, 786
4 odd divisors
1, 3, 131, 393
How to compute the divisors of 786?
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 786 by each of the numbers from 1 to 786 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 786 / 1 = 786 (the remainder is 0, so 1 is a divisor of 786)
- 786 / 2 = 393 (the remainder is 0, so 2 is a divisor of 786)
- 786 / 3 = 262 (the remainder is 0, so 3 is a divisor of 786)
- ...
- 786 / 785 = 1.0012738853503 (the remainder is 1, so 785 is not a divisor of 786)
- 786 / 786 = 1 (the remainder is 0, so 786 is a divisor of 786)
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 786 (i.e. 28.035691537752). 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 )
- 786 / 1 = 786 (the remainder is 0, so 1 and 786 are divisors of 786)
- 786 / 2 = 393 (the remainder is 0, so 2 and 393 are divisors of 786)
- 786 / 3 = 262 (the remainder is 0, so 3 and 262 are divisors of 786)
- ...
- 786 / 27 = 29.111111111111 (the remainder is 3, so 27 is not a divisor of 786)
- 786 / 28 = 28.071428571429 (the remainder is 2, so 28 is not a divisor of 786)