What are the divisors of 4185?

1, 3, 5, 9, 15, 27, 31, 45, 93, 135, 155, 279, 465, 837, 1395, 4185

16 odd divisors

1, 3, 5, 9, 15, 27, 31, 45, 93, 135, 155, 279, 465, 837, 1395, 4185

How to compute the divisors of 4185?

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

  • 4185 / 1 = 4185 (the remainder is 0, so 1 is a divisor of 4185)
  • 4185 / 2 = 2092.5 (the remainder is 1, so 2 is not a divisor of 4185)
  • 4185 / 3 = 1395 (the remainder is 0, so 3 is a divisor of 4185)
  • ...
  • 4185 / 4184 = 1.0002390057361 (the remainder is 1, so 4184 is not a divisor of 4185)
  • 4185 / 4185 = 1 (the remainder is 0, so 4185 is a divisor of 4185)

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 4185 (i.e. 64.691575958543). 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 )

  • 4185 / 1 = 4185 (the remainder is 0, so 1 and 4185 are divisors of 4185)
  • 4185 / 2 = 2092.5 (the remainder is 1, so 2 is not a divisor of 4185)
  • 4185 / 3 = 1395 (the remainder is 0, so 3 and 1395 are divisors of 4185)
  • ...
  • 4185 / 63 = 66.428571428571 (the remainder is 27, so 63 is not a divisor of 4185)
  • 4185 / 64 = 65.390625 (the remainder is 25, so 64 is not a divisor of 4185)