What are the divisors of 4112?

1, 2, 4, 8, 16, 257, 514, 1028, 2056, 4112

8 even divisors

2, 4, 8, 16, 514, 1028, 2056, 4112

2 odd divisors

1, 257

How to compute the divisors of 4112?

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

  • 4112 / 1 = 4112 (the remainder is 0, so 1 is a divisor of 4112)
  • 4112 / 2 = 2056 (the remainder is 0, so 2 is a divisor of 4112)
  • 4112 / 3 = 1370.6666666667 (the remainder is 2, so 3 is not a divisor of 4112)
  • ...
  • 4112 / 4111 = 1.0002432498176 (the remainder is 1, so 4111 is not a divisor of 4112)
  • 4112 / 4112 = 1 (the remainder is 0, so 4112 is a divisor of 4112)

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 4112 (i.e. 64.124878167526). 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 )

  • 4112 / 1 = 4112 (the remainder is 0, so 1 and 4112 are divisors of 4112)
  • 4112 / 2 = 2056 (the remainder is 0, so 2 and 2056 are divisors of 4112)
  • 4112 / 3 = 1370.6666666667 (the remainder is 2, so 3 is not a divisor of 4112)
  • ...
  • 4112 / 63 = 65.269841269841 (the remainder is 17, so 63 is not a divisor of 4112)
  • 4112 / 64 = 64.25 (the remainder is 16, so 64 is not a divisor of 4112)