What are the divisors of 5064?

1, 2, 3, 4, 6, 8, 12, 24, 211, 422, 633, 844, 1266, 1688, 2532, 5064

12 even divisors

2, 4, 6, 8, 12, 24, 422, 844, 1266, 1688, 2532, 5064

4 odd divisors

1, 3, 211, 633

How to compute the divisors of 5064?

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

  • 5064 / 1 = 5064 (the remainder is 0, so 1 is a divisor of 5064)
  • 5064 / 2 = 2532 (the remainder is 0, so 2 is a divisor of 5064)
  • 5064 / 3 = 1688 (the remainder is 0, so 3 is a divisor of 5064)
  • ...
  • 5064 / 5063 = 1.0001975113569 (the remainder is 1, so 5063 is not a divisor of 5064)
  • 5064 / 5064 = 1 (the remainder is 0, so 5064 is a divisor of 5064)

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 5064 (i.e. 71.161787498629). 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 )

  • 5064 / 1 = 5064 (the remainder is 0, so 1 and 5064 are divisors of 5064)
  • 5064 / 2 = 2532 (the remainder is 0, so 2 and 2532 are divisors of 5064)
  • 5064 / 3 = 1688 (the remainder is 0, so 3 and 1688 are divisors of 5064)
  • ...
  • 5064 / 70 = 72.342857142857 (the remainder is 24, so 70 is not a divisor of 5064)
  • 5064 / 71 = 71.323943661972 (the remainder is 23, so 71 is not a divisor of 5064)