By definition, a factor is one of two or more positive numbers that when multiplied together produce a given product.  For example, given the integer 24, the factors are [1, 2, 3, 4, 6, 8, 12, 24].

The below algorithm tests the range of numbers from 1 to a given integer.  If the given integer divided by the current number returns a remainder of 0, then the current number is a factor of the given integer.


Get the source control, including unit tests: (9.85 kb)