bool DigitFactors::factors_helper(int digit)
{
int subDiv = digit;
if (subDiv == 1) return true;
for (int j = 2; j <= digit; ++j)
if ( (subDiv % j) == 0)
{
subDiv = subDiv/ j;
vec.push_back(j);
return factors_helper(subDiv);
}
return factors_helper(subDiv);
}
No comments:
Post a Comment