What are the divisors of 390?

1, 2, 3, 5, 6, 10, 13, 15, 26, 30, 39, 65, 78, 130, 195, 390

8 even divisors

2, 6, 10, 26, 30, 78, 130, 390

8 odd divisors

1, 3, 5, 13, 15, 39, 65, 195

How to compute the divisors of 390?

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

  • 390 / 1 = 390 (the remainder is 0, so 1 is a divisor of 390)
  • 390 / 2 = 195 (the remainder is 0, so 2 is a divisor of 390)
  • 390 / 3 = 130 (the remainder is 0, so 3 is a divisor of 390)
  • ...
  • 390 / 389 = 1.0025706940874 (the remainder is 1, so 389 is not a divisor of 390)
  • 390 / 390 = 1 (the remainder is 0, so 390 is a divisor of 390)

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 390 (i.e. 19.748417658131). 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 )

  • 390 / 1 = 390 (the remainder is 0, so 1 and 390 are divisors of 390)
  • 390 / 2 = 195 (the remainder is 0, so 2 and 195 are divisors of 390)
  • 390 / 3 = 130 (the remainder is 0, so 3 and 130 are divisors of 390)
  • ...
  • 390 / 18 = 21.666666666667 (the remainder is 12, so 18 is not a divisor of 390)
  • 390 / 19 = 20.526315789474 (the remainder is 10, so 19 is not a divisor of 390)