mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
1d7a73ea58
* feat: add check_amicable_pair.cpp * fix: space between else and brace. * fix: spaces between tokens * fix: removed sqrt and test func combined to single * docs: removed wiki link Co-authored-by: Krishna Vedala <7001608+kvedala@users.noreply.github.com> * docs: add markdown syntax for wikipedia link Co-authored-by: Krishna Vedala <7001608+kvedala@users.noreply.github.com> * docs: change brief to details in comment Line 7 Co-authored-by: Krishna Vedala <7001608+kvedala@users.noreply.github.com> * docs: typo fixed Co-authored-by: Krishna Vedala <7001608+kvedala@users.noreply.github.com> * docs: removed extra line Co-authored-by: Krishna Vedala <7001608+kvedala@users.noreply.github.com> * docs: removed copyright Co-authored-by: Krishna Vedala <7001608+kvedala@users.noreply.github.com> * docs: add author name Co-authored-by: Krishna Vedala <7001608+kvedala@users.noreply.github.com> * fix: shortened the code in is_amicable() Co-authored-by: David Leal <halfpacho@gmail.com> * fix: changed is_amicable to are_amicable * docs: cleared unwanted line Co-authored-by: Krishna Vedala <7001608+kvedala@users.noreply.github.com> Co-authored-by: Krishna Vedala <7001608+kvedala@users.noreply.github.com> Co-authored-by: David Leal <halfpacho@gmail.com> |
||
---|---|---|
.. | ||
binary_exponent.cpp | ||
check_amicable_pair.cpp | ||
check_prime.cpp | ||
CMakeLists.txt | ||
complex_numbers.cpp | ||
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 | ||
sum_of_digits.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