TheAlgorithms-C-Plus-Plus/math
2020-05-27 18:52:07 -04:00
..
binary_exponent.cpp documetnation for binary_exponent.cpp 2020-05-27 09:13:21 -04:00
CMakeLists.txt added cmake to math, others and compu_stats 2020-05-25 23:42:37 -04:00
double_factorial.cpp documentation update for double_factorial 2020-05-27 14:07:05 -04:00
eulers_totient_function.cpp documentation for eulers_totient_function.cpp 2020-05-27 14:07:18 -04:00
extended_euclid_algorithm.cpp fix cpplint 2020-05-27 16:44:58 -04:00
factorial.cpp factorial.cpp (#561) 2019-12-05 23:02:52 +01:00
fast_power.cpp improve documentation for fast_power 2020-05-27 15:14:39 -04:00
fibonacci.cpp fibonacci documentation 2020-05-27 17:58:17 -04:00
gcd_iterative_euclidean.cpp better document GCD programs 2020-05-27 15:42:12 -04:00
gcd_of_n_numbers.cpp move the gcd_of_n_numbers to math folder along with all other GCD algorithms 2020-05-27 18:52:07 -04:00
gcd_recursive_euclidean.cpp better document GCD programs 2020-05-27 15:42:12 -04:00
modular_inverse_fermat_little_theorem.cpp documentation for Little Fermat's Thm 2020-05-27 16:09:50 -04:00
number_of_positive_divisors.cpp documetnation for positive divisors 2020-05-27 16:22:10 -04:00
power_for_huge_numbers.cpp docs for large number power 2020-05-27 16:22:22 -04:00
prime_factorization.cpp documentation and bug fixes 2020-05-27 16:45:33 -04:00
prime_numbers.cpp documentation and bug fixes 2020-05-27 16:45:33 -04:00
primes_up_to_billion.cpp documentation and bug fixes 2020-05-27 16:45:33 -04:00
README.md math readme title 2020-05-27 16:47:32 -04:00
sieve_of_eratosthenes.cpp documentation and bug fixes 2020-05-27 16:45:33 -04:00
sqrt_double.cpp document square-root that uses bisection method 2020-05-27 16:58:30 -04:00

Prime factorization

Prime Factorization is a very important and useful technique to factorize any number into its prime factors. It has various applications in the field of number theory.

The method of prime factorization involves two function calls. First: Calculating all the prime number up till a certain range using the standard Sieve of Eratosthenes.

Second: Using the prime numbers to reduce the the given number and thus find all its prime factors.

The complexity of the solution involves approx. O(n logn) in calculating sieve of eratosthenes O(log n) in calculating the prime factors of the number. So in total approx. O(n logn).

Requirements: For compile you need the compiler flag for C++ 11