Prime Factorization

Project: Allow the user to input an integer, and output a prime factor tree for that integer.


Break down the integer into smaller integers until you are left with two primes. You can do this with a technique called recursion, which is calling a function within that function.
In this case, the function will take an integer as a parameter, find the first factor, and then call itself with a smaller integer. Eventually, the function will stop calling itself when it cannot find more factors.


Use the remainder operator.
Last section Next section