What are the divisors of 1789?
1, 1789
- There is a total of 2 positive divisors.
- The sum of these divisors is 1790.
- The arithmetic mean is 895.
2 odd divisors
1, 1789
How to compute the divisors of 1789?
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 1789 by each of the numbers from 1 to 1789 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 1789 / 1 = 1789 (the remainder is 0, so 1 is a divisor of 1789)
- 1789 / 2 = 894.5 (the remainder is 1, so 2 is not a divisor of 1789)
- 1789 / 3 = 596.33333333333 (the remainder is 1, so 3 is not a divisor of 1789)
- ...
- 1789 / 1788 = 1.0005592841163 (the remainder is 1, so 1788 is not a divisor of 1789)
- 1789 / 1789 = 1 (the remainder is 0, so 1789 is a divisor of 1789)
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 1789 (i.e. 42.296571965113). 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 )
- 1789 / 1 = 1789 (the remainder is 0, so 1 and 1789 are divisors of 1789)
- 1789 / 2 = 894.5 (the remainder is 1, so 2 is not a divisor of 1789)
- 1789 / 3 = 596.33333333333 (the remainder is 1, so 3 is not a divisor of 1789)
- ...
- 1789 / 41 = 43.634146341463 (the remainder is 26, so 41 is not a divisor of 1789)
- 1789 / 42 = 42.595238095238 (the remainder is 25, so 42 is not a divisor of 1789)