What are the divisors of 4212?

1, 2, 3, 4, 6, 9, 12, 13, 18, 26, 27, 36, 39, 52, 54, 78, 81, 108, 117, 156, 162, 234, 324, 351, 468, 702, 1053, 1404, 2106, 4212

20 even divisors

2, 4, 6, 12, 18, 26, 36, 52, 54, 78, 108, 156, 162, 234, 324, 468, 702, 1404, 2106, 4212

10 odd divisors

1, 3, 9, 13, 27, 39, 81, 117, 351, 1053

How to compute the divisors of 4212?

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

  • 4212 / 1 = 4212 (the remainder is 0, so 1 is a divisor of 4212)
  • 4212 / 2 = 2106 (the remainder is 0, so 2 is a divisor of 4212)
  • 4212 / 3 = 1404 (the remainder is 0, so 3 is a divisor of 4212)
  • ...
  • 4212 / 4211 = 1.0002374732843 (the remainder is 1, so 4211 is not a divisor of 4212)
  • 4212 / 4212 = 1 (the remainder is 0, so 4212 is a divisor of 4212)

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 4212 (i.e. 64.899922958352). 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 )

  • 4212 / 1 = 4212 (the remainder is 0, so 1 and 4212 are divisors of 4212)
  • 4212 / 2 = 2106 (the remainder is 0, so 2 and 2106 are divisors of 4212)
  • 4212 / 3 = 1404 (the remainder is 0, so 3 and 1404 are divisors of 4212)
  • ...
  • 4212 / 63 = 66.857142857143 (the remainder is 54, so 63 is not a divisor of 4212)
  • 4212 / 64 = 65.8125 (the remainder is 52, so 64 is not a divisor of 4212)