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 count of factors 8.

The below algorithm tests the range of numbers from 1 to a given integer.  If the given interger 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: GetFactorsCount.zip (9.43 kb)