What are the divisors of 3120?

1, 2, 3, 4, 5, 6, 8, 10, 12, 13, 15, 16, 20, 24, 26, 30, 39, 40, 48, 52, 60, 65, 78, 80, 104, 120, 130, 156, 195, 208, 240, 260, 312, 390, 520, 624, 780, 1040, 1560, 3120

32 even divisors

2, 4, 6, 8, 10, 12, 16, 20, 24, 26, 30, 40, 48, 52, 60, 78, 80, 104, 120, 130, 156, 208, 240, 260, 312, 390, 520, 624, 780, 1040, 1560, 3120

8 odd divisors

1, 3, 5, 13, 15, 39, 65, 195

How to compute the divisors of 3120?

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

  • 3120 / 1 = 3120 (the remainder is 0, so 1 is a divisor of 3120)
  • 3120 / 2 = 1560 (the remainder is 0, so 2 is a divisor of 3120)
  • 3120 / 3 = 1040 (the remainder is 0, so 3 is a divisor of 3120)
  • ...
  • 3120 / 3119 = 1.0003206155819 (the remainder is 1, so 3119 is not a divisor of 3120)
  • 3120 / 3120 = 1 (the remainder is 0, so 3120 is a divisor of 3120)

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 3120 (i.e. 55.856960175076). 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 )

  • 3120 / 1 = 3120 (the remainder is 0, so 1 and 3120 are divisors of 3120)
  • 3120 / 2 = 1560 (the remainder is 0, so 2 and 1560 are divisors of 3120)
  • 3120 / 3 = 1040 (the remainder is 0, so 3 and 1040 are divisors of 3120)
  • ...
  • 3120 / 54 = 57.777777777778 (the remainder is 42, so 54 is not a divisor of 3120)
  • 3120 / 55 = 56.727272727273 (the remainder is 40, so 55 is not a divisor of 3120)