What are the divisors of 8158?
1, 2, 4079, 8158
- There is a total of 4 positive divisors.
- The sum of these divisors is 12240.
- The arithmetic mean is 3060.
2 even divisors
2, 8158
2 odd divisors
1, 4079
How to compute the divisors of 8158?
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 8158 by each of the numbers from 1 to 8158 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 8158 / 1 = 8158 (the remainder is 0, so 1 is a divisor of 8158)
- 8158 / 2 = 4079 (the remainder is 0, so 2 is a divisor of 8158)
- 8158 / 3 = 2719.3333333333 (the remainder is 1, so 3 is not a divisor of 8158)
- ...
- 8158 / 8157 = 1.000122594091 (the remainder is 1, so 8157 is not a divisor of 8158)
- 8158 / 8158 = 1 (the remainder is 0, so 8158 is a divisor of 8158)
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 8158 (i.e. 90.321647460617). 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 )
- 8158 / 1 = 8158 (the remainder is 0, so 1 and 8158 are divisors of 8158)
- 8158 / 2 = 4079 (the remainder is 0, so 2 and 4079 are divisors of 8158)
- 8158 / 3 = 2719.3333333333 (the remainder is 1, so 3 is not a divisor of 8158)
- ...
- 8158 / 89 = 91.662921348315 (the remainder is 59, so 89 is not a divisor of 8158)
- 8158 / 90 = 90.644444444444 (the remainder is 58, so 90 is not a divisor of 8158)