What are the divisors of 5160?

1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 20, 24, 30, 40, 43, 60, 86, 120, 129, 172, 215, 258, 344, 430, 516, 645, 860, 1032, 1290, 1720, 2580, 5160

24 even divisors

2, 4, 6, 8, 10, 12, 20, 24, 30, 40, 60, 86, 120, 172, 258, 344, 430, 516, 860, 1032, 1290, 1720, 2580, 5160

8 odd divisors

1, 3, 5, 15, 43, 129, 215, 645

How to compute the divisors of 5160?

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

  • 5160 / 1 = 5160 (the remainder is 0, so 1 is a divisor of 5160)
  • 5160 / 2 = 2580 (the remainder is 0, so 2 is a divisor of 5160)
  • 5160 / 3 = 1720 (the remainder is 0, so 3 is a divisor of 5160)
  • ...
  • 5160 / 5159 = 1.0001938360147 (the remainder is 1, so 5159 is not a divisor of 5160)
  • 5160 / 5160 = 1 (the remainder is 0, so 5160 is a divisor of 5160)

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 5160 (i.e. 71.833139984272). 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 )

  • 5160 / 1 = 5160 (the remainder is 0, so 1 and 5160 are divisors of 5160)
  • 5160 / 2 = 2580 (the remainder is 0, so 2 and 2580 are divisors of 5160)
  • 5160 / 3 = 1720 (the remainder is 0, so 3 and 1720 are divisors of 5160)
  • ...
  • 5160 / 70 = 73.714285714286 (the remainder is 50, so 70 is not a divisor of 5160)
  • 5160 / 71 = 72.676056338028 (the remainder is 48, so 71 is not a divisor of 5160)