What are the divisors of 396?

1, 2, 3, 4, 6, 9, 11, 12, 18, 22, 33, 36, 44, 66, 99, 132, 198, 396

12 even divisors

2, 4, 6, 12, 18, 22, 36, 44, 66, 132, 198, 396

6 odd divisors

1, 3, 9, 11, 33, 99

How to compute the divisors of 396?

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

  • 396 / 1 = 396 (the remainder is 0, so 1 is a divisor of 396)
  • 396 / 2 = 198 (the remainder is 0, so 2 is a divisor of 396)
  • 396 / 3 = 132 (the remainder is 0, so 3 is a divisor of 396)
  • ...
  • 396 / 395 = 1.0025316455696 (the remainder is 1, so 395 is not a divisor of 396)
  • 396 / 396 = 1 (the remainder is 0, so 396 is a divisor of 396)

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 396 (i.e. 19.899748742132). 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 )

  • 396 / 1 = 396 (the remainder is 0, so 1 and 396 are divisors of 396)
  • 396 / 2 = 198 (the remainder is 0, so 2 and 198 are divisors of 396)
  • 396 / 3 = 132 (the remainder is 0, so 3 and 132 are divisors of 396)
  • ...
  • 396 / 18 = 22 (the remainder is 0, so 18 and 22 are divisors of 396)
  • 396 / 19 = 20.842105263158 (the remainder is 16, so 19 is not a divisor of 396)