What are the divisors of 522?

1, 2, 3, 6, 9, 18, 29, 58, 87, 174, 261, 522

6 even divisors

2, 6, 18, 58, 174, 522

6 odd divisors

1, 3, 9, 29, 87, 261

How to compute the divisors of 522?

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

  • 522 / 1 = 522 (the remainder is 0, so 1 is a divisor of 522)
  • 522 / 2 = 261 (the remainder is 0, so 2 is a divisor of 522)
  • 522 / 3 = 174 (the remainder is 0, so 3 is a divisor of 522)
  • ...
  • 522 / 521 = 1.0019193857965 (the remainder is 1, so 521 is not a divisor of 522)
  • 522 / 522 = 1 (the remainder is 0, so 522 is a divisor of 522)

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 522 (i.e. 22.847319317592). 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 )

  • 522 / 1 = 522 (the remainder is 0, so 1 and 522 are divisors of 522)
  • 522 / 2 = 261 (the remainder is 0, so 2 and 261 are divisors of 522)
  • 522 / 3 = 174 (the remainder is 0, so 3 and 174 are divisors of 522)
  • ...
  • 522 / 21 = 24.857142857143 (the remainder is 18, so 21 is not a divisor of 522)
  • 522 / 22 = 23.727272727273 (the remainder is 16, so 22 is not a divisor of 522)