What are the divisors of 160?

1, 2, 4, 5, 8, 10, 16, 20, 32, 40, 80, 160

10 even divisors

2, 4, 8, 10, 16, 20, 32, 40, 80, 160

2 odd divisors

1, 5

How to compute the divisors of 160?

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

  • 160 / 1 = 160 (the remainder is 0, so 1 is a divisor of 160)
  • 160 / 2 = 80 (the remainder is 0, so 2 is a divisor of 160)
  • 160 / 3 = 53.333333333333 (the remainder is 1, so 3 is not a divisor of 160)
  • ...
  • 160 / 159 = 1.0062893081761 (the remainder is 1, so 159 is not a divisor of 160)
  • 160 / 160 = 1 (the remainder is 0, so 160 is a divisor of 160)

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 160 (i.e. 12.649110640674). 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 )

  • 160 / 1 = 160 (the remainder is 0, so 1 and 160 are divisors of 160)
  • 160 / 2 = 80 (the remainder is 0, so 2 and 80 are divisors of 160)
  • 160 / 3 = 53.333333333333 (the remainder is 1, so 3 is not a divisor of 160)
  • ...
  • 160 / 11 = 14.545454545455 (the remainder is 6, so 11 is not a divisor of 160)
  • 160 / 12 = 13.333333333333 (the remainder is 4, so 12 is not a divisor of 160)