0

Hey All

Yesterday I was writing a recursive form of a prime factorization program and I wasn't sure about the syntax I used. the function works as is but I'm curious if I am being redundant or if this is the proper way to code it.

Here is what I came up with

```
void PrimeFactorize(unsigned int number, vector<unsigned int> & factors)
{
if (number == 1)
return;
if (number % 2 == 0)
{
factors.push_back(2);
return PrimeFactorize(number / 2, factors); // not sure about this
}
else
{
for (unsigned int i = 3; i <= number; i += 2)
{
if (number % i == 0)
{
factors.push_back(i);
return PrimeFactorize(number / i, factors); // here too
}
}
}
return;
}
```

The syntax I am talking about is on lines 8 and 17. I didn't know if I should put the return in or just call the function.