What are the divisors of 78?

1, 2, 3, 6, 13, 26, 39, 78

4 even divisors

2, 6, 26, 78

4 odd divisors

1, 3, 13, 39

How to compute the divisors of 78?

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

  • 78 / 1 = 78 (the remainder is 0, so 1 is a divisor of 78)
  • 78 / 2 = 39 (the remainder is 0, so 2 is a divisor of 78)
  • 78 / 3 = 26 (the remainder is 0, so 3 is a divisor of 78)
  • ...
  • 78 / 77 = 1.012987012987 (the remainder is 1, so 77 is not a divisor of 78)
  • 78 / 78 = 1 (the remainder is 0, so 78 is a divisor of 78)

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 78 (i.e. 8.8317608663278). 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 )

  • 78 / 1 = 78 (the remainder is 0, so 1 and 78 are divisors of 78)
  • 78 / 2 = 39 (the remainder is 0, so 2 and 39 are divisors of 78)
  • 78 / 3 = 26 (the remainder is 0, so 3 and 26 are divisors of 78)
  • ...
  • 78 / 7 = 11.142857142857 (the remainder is 1, so 7 is not a divisor of 78)
  • 78 / 8 = 9.75 (the remainder is 6, so 8 is not a divisor of 78)