What are the divisors of 1250?

1, 2, 5, 10, 25, 50, 125, 250, 625, 1250

5 even divisors

2, 10, 50, 250, 1250

5 odd divisors

1, 5, 25, 125, 625

How to compute the divisors of 1250?

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.

N mod M = 0

Brute force algorithm

We could start by using a brute-force method which would involve dividing 1250 by each of the numbers from 1 to 1250 to determine which ones have a remainder equal to 0.

Remainder = N ( M × N M )

(where N M is the integer part of the quotient)

  • 1250 / 1 = 1250 (the remainder is 0, so 1 is a divisor of 1250)
  • 1250 / 2 = 625 (the remainder is 0, so 2 is a divisor of 1250)
  • 1250 / 3 = 416.66666666667 (the remainder is 2, so 3 is not a divisor of 1250)
  • ...
  • 1250 / 1249 = 1.0008006405124 (the remainder is 1, so 1249 is not a divisor of 1250)
  • 1250 / 1250 = 1 (the remainder is 0, so 1250 is a divisor of 1250)

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 1250 (i.e. 35.355339059327). Indeed, if a number N has a divisor D greater than its square root, then there is necessarily a smaller divisor d such that:

D × d = N

(thus, if N D = d , then N d = D )

  • 1250 / 1 = 1250 (the remainder is 0, so 1 and 1250 are divisors of 1250)
  • 1250 / 2 = 625 (the remainder is 0, so 2 and 625 are divisors of 1250)
  • 1250 / 3 = 416.66666666667 (the remainder is 2, so 3 is not a divisor of 1250)
  • ...
  • 1250 / 34 = 36.764705882353 (the remainder is 26, so 34 is not a divisor of 1250)
  • 1250 / 35 = 35.714285714286 (the remainder is 25, so 35 is not a divisor of 1250)