What are the divisors of 5046?

1, 2, 3, 6, 29, 58, 87, 174, 841, 1682, 2523, 5046

6 even divisors

2, 6, 58, 174, 1682, 5046

6 odd divisors

1, 3, 29, 87, 841, 2523

How to compute the divisors of 5046?

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

  • 5046 / 1 = 5046 (the remainder is 0, so 1 is a divisor of 5046)
  • 5046 / 2 = 2523 (the remainder is 0, so 2 is a divisor of 5046)
  • 5046 / 3 = 1682 (the remainder is 0, so 3 is a divisor of 5046)
  • ...
  • 5046 / 5045 = 1.0001982160555 (the remainder is 1, so 5045 is not a divisor of 5046)
  • 5046 / 5046 = 1 (the remainder is 0, so 5046 is a divisor of 5046)

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 5046 (i.e. 71.035202540712). 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 )

  • 5046 / 1 = 5046 (the remainder is 0, so 1 and 5046 are divisors of 5046)
  • 5046 / 2 = 2523 (the remainder is 0, so 2 and 2523 are divisors of 5046)
  • 5046 / 3 = 1682 (the remainder is 0, so 3 and 1682 are divisors of 5046)
  • ...
  • 5046 / 70 = 72.085714285714 (the remainder is 6, so 70 is not a divisor of 5046)
  • 5046 / 71 = 71.070422535211 (the remainder is 5, so 71 is not a divisor of 5046)