TheAlgorithms-C-Plus-Plus/math
5ur3 0ce3226f00 Create PrimeNumbers.cpp (#607)
* Create PrimeNumbers.cpp

* Rename Math/PrimeNumbers/PrimeNumbers.cpp to math/prime_numbers.cpp

* Trailing whitespace, std::cin, std::cout, std::endl

* std::vector

* std::vector again
2019-12-04 09:05:08 +01:00
..
power_for_huge_numbers.cpp Flatten the math directory (#657) 2019-11-28 14:34:13 +01:00
prime_factorization.cpp Flatten the math directory (#657) 2019-11-28 14:34:13 +01:00
prime_numbers.cpp Create PrimeNumbers.cpp (#607) 2019-12-04 09:05:08 +01:00
README.md Flatten the math directory (#657) 2019-11-28 14:34:13 +01:00
sieve_of_eratosthenes.cpp Flatten the math directory (#657) 2019-11-28 14:34:13 +01:00

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