What are the divisors of 3240?

1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 18, 20, 24, 27, 30, 36, 40, 45, 54, 60, 72, 81, 90, 108, 120, 135, 162, 180, 216, 270, 324, 360, 405, 540, 648, 810, 1080, 1620, 3240

30 even divisors

2, 4, 6, 8, 10, 12, 18, 20, 24, 30, 36, 40, 54, 60, 72, 90, 108, 120, 162, 180, 216, 270, 324, 360, 540, 648, 810, 1080, 1620, 3240

10 odd divisors

1, 3, 5, 9, 15, 27, 45, 81, 135, 405

How to compute the divisors of 3240?

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

  • 3240 / 1 = 3240 (the remainder is 0, so 1 is a divisor of 3240)
  • 3240 / 2 = 1620 (the remainder is 0, so 2 is a divisor of 3240)
  • 3240 / 3 = 1080 (the remainder is 0, so 3 is a divisor of 3240)
  • ...
  • 3240 / 3239 = 1.0003087372646 (the remainder is 1, so 3239 is not a divisor of 3240)
  • 3240 / 3240 = 1 (the remainder is 0, so 3240 is a divisor of 3240)

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 3240 (i.e. 56.920997883031). 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 )

  • 3240 / 1 = 3240 (the remainder is 0, so 1 and 3240 are divisors of 3240)
  • 3240 / 2 = 1620 (the remainder is 0, so 2 and 1620 are divisors of 3240)
  • 3240 / 3 = 1080 (the remainder is 0, so 3 and 1080 are divisors of 3240)
  • ...
  • 3240 / 55 = 58.909090909091 (the remainder is 50, so 55 is not a divisor of 3240)
  • 3240 / 56 = 57.857142857143 (the remainder is 48, so 56 is not a divisor of 3240)