a: Implement the function leastFactor(int n) returns the least factor m such that n=mk for some integerk. For example, if n=21, leastFactor(n) should return 3 since 21=3*7
b: Implement the funtion factorization(int n) that prints all prime factors of n. For example, if n-36, factorization(n) should print out 36=2*2*3*3.
c: Search internet about the integer factorizaiton problem and its importance. What is its connection with cryptograph and security?
using namespace std;
//return the least factor of n.
int leastFactor(int n)
//print out all prime factors of n via calling least-factor().
void factorization(int n)
Last edited on