What are the divisors of 1296?

1, 2, 3, 4, 6, 8, 9, 12, 16, 18, 24, 27, 36, 48, 54, 72, 81, 108, 144, 162, 216, 324, 432, 648, 1296

20 even divisors

2, 4, 6, 8, 12, 16, 18, 24, 36, 48, 54, 72, 108, 144, 162, 216, 324, 432, 648, 1296

5 odd divisors

1, 3, 9, 27, 81

How to compute the divisors of 1296?

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

  • 1296 / 1 = 1296 (the remainder is 0, so 1 is a divisor of 1296)
  • 1296 / 2 = 648 (the remainder is 0, so 2 is a divisor of 1296)
  • 1296 / 3 = 432 (the remainder is 0, so 3 is a divisor of 1296)
  • ...
  • 1296 / 1295 = 1.0007722007722 (the remainder is 1, so 1295 is not a divisor of 1296)
  • 1296 / 1296 = 1 (the remainder is 0, so 1296 is a divisor of 1296)

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 1296 (i.e. 36). 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 )

  • 1296 / 1 = 1296 (the remainder is 0, so 1 and 1296 are divisors of 1296)
  • 1296 / 2 = 648 (the remainder is 0, so 2 and 648 are divisors of 1296)
  • 1296 / 3 = 432 (the remainder is 0, so 3 and 432 are divisors of 1296)
  • ...
  • 1296 / 35 = 37.028571428571 (the remainder is 1, so 35 is not a divisor of 1296)
  • 1296 / 36 = 36 (the remainder is 0, so 36 and 36 are divisors of 1296)