Skip to content
Blog Snippets About

Get Divisors


This function takes an integer n and returns an array of all its divisors by checking each integer from 2 to n/2 to see if it divides n without a remainder.

Note that 1 is always included as a divisor.