Help with an Assignment is needed!

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?
#include <iostream>
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)


int main()
int n;
return 0;

Last edited on
Topic archived. No new replies allowed.