What are the divisors of 1026?

1, 2, 3, 6, 9, 18, 19, 27, 38, 54, 57, 114, 171, 342, 513, 1026

8 even divisors

2, 6, 18, 38, 54, 114, 342, 1026

8 odd divisors

1, 3, 9, 19, 27, 57, 171, 513

How to compute the divisors of 1026?

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

  • 1026 / 1 = 1026 (the remainder is 0, so 1 is a divisor of 1026)
  • 1026 / 2 = 513 (the remainder is 0, so 2 is a divisor of 1026)
  • 1026 / 3 = 342 (the remainder is 0, so 3 is a divisor of 1026)
  • ...
  • 1026 / 1025 = 1.0009756097561 (the remainder is 1, so 1025 is not a divisor of 1026)
  • 1026 / 1026 = 1 (the remainder is 0, so 1026 is a divisor of 1026)

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 1026 (i.e. 32.031234756094). 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 )

  • 1026 / 1 = 1026 (the remainder is 0, so 1 and 1026 are divisors of 1026)
  • 1026 / 2 = 513 (the remainder is 0, so 2 and 513 are divisors of 1026)
  • 1026 / 3 = 342 (the remainder is 0, so 3 and 342 are divisors of 1026)
  • ...
  • 1026 / 31 = 33.096774193548 (the remainder is 3, so 31 is not a divisor of 1026)
  • 1026 / 32 = 32.0625 (the remainder is 2, so 32 is not a divisor of 1026)