mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
a48d05fb62
* feat: Added a probabilitic Miller-Rabin Primality test * docs: Documentation Changes * fix: Issue with the assert call * docs: grammatical error * docs: corrected the copyright comment * docs: Fixed some documentation issues. * docs: fix latex issues * docs and fix: Fixed documentation issues and vector by const reference and iterator over const reference. * docs: fixed latex documentation issue. * docs: spelling errors * docs: spelling error fixed |
||
---|---|---|
.. | ||
binary_exponent.cpp | ||
check_prime.cpp | ||
CMakeLists.txt | ||
double_factorial.cpp | ||
eulers_totient_function.cpp | ||
extended_euclid_algorithm.cpp | ||
factorial.cpp | ||
fast_power.cpp | ||
fibonacci_fast.cpp | ||
fibonacci_large.cpp | ||
fibonacci.cpp | ||
gcd_iterative_euclidean.cpp | ||
gcd_of_n_numbers.cpp | ||
gcd_recursive_euclidean.cpp | ||
large_factorial.cpp | ||
large_number.h | ||
least_common_multiple.cpp | ||
miller_rabin.cpp | ||
modular_inverse_fermat_little_theorem.cpp | ||
number_of_positive_divisors.cpp | ||
power_for_huge_numbers.cpp | ||
prime_factorization.cpp | ||
prime_numbers.cpp | ||
primes_up_to_billion.cpp | ||
README.md | ||
realtime_stats.cpp | ||
sieve_of_eratosthenes.cpp | ||
sqrt_double.cpp | ||
string_fibonacci.cpp |
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