What are the divisors of 5095?

1, 5, 1019, 5095

4 odd divisors

1, 5, 1019, 5095

How to compute the divisors of 5095?

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

  • 5095 / 1 = 5095 (the remainder is 0, so 1 is a divisor of 5095)
  • 5095 / 2 = 2547.5 (the remainder is 1, so 2 is not a divisor of 5095)
  • 5095 / 3 = 1698.3333333333 (the remainder is 1, so 3 is not a divisor of 5095)
  • ...
  • 5095 / 5094 = 1.0001963093836 (the remainder is 1, so 5094 is not a divisor of 5095)
  • 5095 / 5095 = 1 (the remainder is 0, so 5095 is a divisor of 5095)

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 5095 (i.e. 71.379268698972). 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 )

  • 5095 / 1 = 5095 (the remainder is 0, so 1 and 5095 are divisors of 5095)
  • 5095 / 2 = 2547.5 (the remainder is 1, so 2 is not a divisor of 5095)
  • 5095 / 3 = 1698.3333333333 (the remainder is 1, so 3 is not a divisor of 5095)
  • ...
  • 5095 / 70 = 72.785714285714 (the remainder is 55, so 70 is not a divisor of 5095)
  • 5095 / 71 = 71.760563380282 (the remainder is 54, so 71 is not a divisor of 5095)