What are the divisors of 1240?
1, 2, 4, 5, 8, 10, 20, 31, 40, 62, 124, 155, 248, 310, 620, 1240
- There is a total of 16 positive divisors.
- The sum of these divisors is 2880.
- The arithmetic mean is 180.
12 even divisors
2, 4, 8, 10, 20, 40, 62, 124, 248, 310, 620, 1240
4 odd divisors
1, 5, 31, 155
How to compute the divisors of 1240?
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 1240 by each of the numbers from 1 to 1240 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 1240 / 1 = 1240 (the remainder is 0, so 1 is a divisor of 1240)
- 1240 / 2 = 620 (the remainder is 0, so 2 is a divisor of 1240)
- 1240 / 3 = 413.33333333333 (the remainder is 1, so 3 is not a divisor of 1240)
- ...
- 1240 / 1239 = 1.000807102502 (the remainder is 1, so 1239 is not a divisor of 1240)
- 1240 / 1240 = 1 (the remainder is 0, so 1240 is a divisor of 1240)
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 1240 (i.e. 35.213633723318). 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 )
- 1240 / 1 = 1240 (the remainder is 0, so 1 and 1240 are divisors of 1240)
- 1240 / 2 = 620 (the remainder is 0, so 2 and 620 are divisors of 1240)
- 1240 / 3 = 413.33333333333 (the remainder is 1, so 3 is not a divisor of 1240)
- ...
- 1240 / 34 = 36.470588235294 (the remainder is 16, so 34 is not a divisor of 1240)
- 1240 / 35 = 35.428571428571 (the remainder is 15, so 35 is not a divisor of 1240)