What are the divisors of 5100?

1, 2, 3, 4, 5, 6, 10, 12, 15, 17, 20, 25, 30, 34, 50, 51, 60, 68, 75, 85, 100, 102, 150, 170, 204, 255, 300, 340, 425, 510, 850, 1020, 1275, 1700, 2550, 5100

24 even divisors

2, 4, 6, 10, 12, 20, 30, 34, 50, 60, 68, 100, 102, 150, 170, 204, 300, 340, 510, 850, 1020, 1700, 2550, 5100

12 odd divisors

1, 3, 5, 15, 17, 25, 51, 75, 85, 255, 425, 1275

How to compute the divisors of 5100?

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

  • 5100 / 1 = 5100 (the remainder is 0, so 1 is a divisor of 5100)
  • 5100 / 2 = 2550 (the remainder is 0, so 2 is a divisor of 5100)
  • 5100 / 3 = 1700 (the remainder is 0, so 3 is a divisor of 5100)
  • ...
  • 5100 / 5099 = 1.0001961168857 (the remainder is 1, so 5099 is not a divisor of 5100)
  • 5100 / 5100 = 1 (the remainder is 0, so 5100 is a divisor of 5100)

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 5100 (i.e. 71.414284285428). 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 )

  • 5100 / 1 = 5100 (the remainder is 0, so 1 and 5100 are divisors of 5100)
  • 5100 / 2 = 2550 (the remainder is 0, so 2 and 2550 are divisors of 5100)
  • 5100 / 3 = 1700 (the remainder is 0, so 3 and 1700 are divisors of 5100)
  • ...
  • 5100 / 70 = 72.857142857143 (the remainder is 60, so 70 is not a divisor of 5100)
  • 5100 / 71 = 71.830985915493 (the remainder is 59, so 71 is not a divisor of 5100)