What are the divisors of 1234?
1, 2, 617, 1234
- There is a total of 4 positive divisors.
- The sum of these divisors is 1854.
- The arithmetic mean is 463.5.
2 even divisors
2, 1234
2 odd divisors
1, 617
How to compute the divisors of 1234?
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 1234 by each of the numbers from 1 to 1234 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 1234 / 1 = 1234 (the remainder is 0, so 1 is a divisor of 1234)
- 1234 / 2 = 617 (the remainder is 0, so 2 is a divisor of 1234)
- 1234 / 3 = 411.33333333333 (the remainder is 1, so 3 is not a divisor of 1234)
- ...
- 1234 / 1233 = 1.0008110300081 (the remainder is 1, so 1233 is not a divisor of 1234)
- 1234 / 1234 = 1 (the remainder is 0, so 1234 is a divisor of 1234)
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 1234 (i.e. 35.128336140501). 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 )
- 1234 / 1 = 1234 (the remainder is 0, so 1 and 1234 are divisors of 1234)
- 1234 / 2 = 617 (the remainder is 0, so 2 and 617 are divisors of 1234)
- 1234 / 3 = 411.33333333333 (the remainder is 1, so 3 is not a divisor of 1234)
- ...
- 1234 / 34 = 36.294117647059 (the remainder is 10, so 34 is not a divisor of 1234)
- 1234 / 35 = 35.257142857143 (the remainder is 9, so 35 is not a divisor of 1234)