What are the divisors of 3108?

1, 2, 3, 4, 6, 7, 12, 14, 21, 28, 37, 42, 74, 84, 111, 148, 222, 259, 444, 518, 777, 1036, 1554, 3108

16 even divisors

2, 4, 6, 12, 14, 28, 42, 74, 84, 148, 222, 444, 518, 1036, 1554, 3108

8 odd divisors

1, 3, 7, 21, 37, 111, 259, 777

How to compute the divisors of 3108?

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

  • 3108 / 1 = 3108 (the remainder is 0, so 1 is a divisor of 3108)
  • 3108 / 2 = 1554 (the remainder is 0, so 2 is a divisor of 3108)
  • 3108 / 3 = 1036 (the remainder is 0, so 3 is a divisor of 3108)
  • ...
  • 3108 / 3107 = 1.0003218538783 (the remainder is 1, so 3107 is not a divisor of 3108)
  • 3108 / 3108 = 1 (the remainder is 0, so 3108 is a divisor of 3108)

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 3108 (i.e. 55.749439459065). 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 )

  • 3108 / 1 = 3108 (the remainder is 0, so 1 and 3108 are divisors of 3108)
  • 3108 / 2 = 1554 (the remainder is 0, so 2 and 1554 are divisors of 3108)
  • 3108 / 3 = 1036 (the remainder is 0, so 3 and 1036 are divisors of 3108)
  • ...
  • 3108 / 54 = 57.555555555556 (the remainder is 30, so 54 is not a divisor of 3108)
  • 3108 / 55 = 56.509090909091 (the remainder is 28, so 55 is not a divisor of 3108)