What are the divisors of 5172?

1, 2, 3, 4, 6, 12, 431, 862, 1293, 1724, 2586, 5172

8 even divisors

2, 4, 6, 12, 862, 1724, 2586, 5172

4 odd divisors

1, 3, 431, 1293

How to compute the divisors of 5172?

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 5172 by each of the numbers from 1 to 5172 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)

  • 5172 / 1 = 5172 (the remainder is 0, so 1 is a divisor of 5172)
  • 5172 / 2 = 2586 (the remainder is 0, so 2 is a divisor of 5172)
  • 5172 / 3 = 1724 (the remainder is 0, so 3 is a divisor of 5172)
  • ...
  • 5172 / 5171 = 1.0001933861922 (the remainder is 1, so 5171 is not a divisor of 5172)
  • 5172 / 5172 = 1 (the remainder is 0, so 5172 is a divisor of 5172)

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 5172 (i.e. 71.916618385461). 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 )

  • 5172 / 1 = 5172 (the remainder is 0, so 1 and 5172 are divisors of 5172)
  • 5172 / 2 = 2586 (the remainder is 0, so 2 and 2586 are divisors of 5172)
  • 5172 / 3 = 1724 (the remainder is 0, so 3 and 1724 are divisors of 5172)
  • ...
  • 5172 / 70 = 73.885714285714 (the remainder is 62, so 70 is not a divisor of 5172)
  • 5172 / 71 = 72.845070422535 (the remainder is 60, so 71 is not a divisor of 5172)