I have tried writing this problem but I keep getting errors andcannot get it to
ID: 3615194 • Letter: I
Question
I have tried writing this problem but I keep getting errors andcannot get it to work even with the algorithm below. Pleasehelp.Write a function to output the prime factors of a number.
void computePrimeFactors(int Number)
The following statements describes the prime factors…
1. If n is even, one factor is 2, then find the prime factors ofn/2
2. If n is divisible by 3, remove this factor and then find theprime factors of the
remainder.
3. If n is divisible by 5, remove this factor and then find theprime factors of the
remainder.
4. and so on…
Here is a description of the above algorithm, where pfr and pf arefunctions…
pfr(n) = 2 and pfr(n/2), if n is even
pfr(n) = pf(n,3), if n is odd
pf(n,m) = none, if n = 1
pf(n,m) = n, if n < m*m
pf(n,m) = m and pf(n/m,m), if m divides n
pf(n,m) = pf(n,m+2), otherwise