What are the divisors of 112?

1, 2, 4, 7, 8, 14, 16, 28, 56, 112

8 even divisors

2, 4, 8, 14, 16, 28, 56, 112

2 odd divisors

1, 7

How to compute the divisors of 112?

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

  • 112 / 1 = 112 (the remainder is 0, so 1 is a divisor of 112)
  • 112 / 2 = 56 (the remainder is 0, so 2 is a divisor of 112)
  • 112 / 3 = 37.333333333333 (the remainder is 1, so 3 is not a divisor of 112)
  • ...
  • 112 / 111 = 1.009009009009 (the remainder is 1, so 111 is not a divisor of 112)
  • 112 / 112 = 1 (the remainder is 0, so 112 is a divisor of 112)

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 112 (i.e. 10.583005244258). 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 )

  • 112 / 1 = 112 (the remainder is 0, so 1 and 112 are divisors of 112)
  • 112 / 2 = 56 (the remainder is 0, so 2 and 56 are divisors of 112)
  • 112 / 3 = 37.333333333333 (the remainder is 1, so 3 is not a divisor of 112)
  • ...
  • 112 / 9 = 12.444444444444 (the remainder is 4, so 9 is not a divisor of 112)
  • 112 / 10 = 11.2 (the remainder is 2, so 10 is not a divisor of 112)