What are the divisors of 150?

1, 2, 3, 5, 6, 10, 15, 25, 30, 50, 75, 150

6 even divisors

2, 6, 10, 30, 50, 150

6 odd divisors

1, 3, 5, 15, 25, 75

How to compute the divisors of 150?

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

  • 150 / 1 = 150 (the remainder is 0, so 1 is a divisor of 150)
  • 150 / 2 = 75 (the remainder is 0, so 2 is a divisor of 150)
  • 150 / 3 = 50 (the remainder is 0, so 3 is a divisor of 150)
  • ...
  • 150 / 149 = 1.006711409396 (the remainder is 1, so 149 is not a divisor of 150)
  • 150 / 150 = 1 (the remainder is 0, so 150 is a divisor of 150)

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 150 (i.e. 12.247448713916). 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 )

  • 150 / 1 = 150 (the remainder is 0, so 1 and 150 are divisors of 150)
  • 150 / 2 = 75 (the remainder is 0, so 2 and 75 are divisors of 150)
  • 150 / 3 = 50 (the remainder is 0, so 3 and 50 are divisors of 150)
  • ...
  • 150 / 11 = 13.636363636364 (the remainder is 7, so 11 is not a divisor of 150)
  • 150 / 12 = 12.5 (the remainder is 6, so 12 is not a divisor of 150)