TheAlgorithms-C-Plus-Plus/math
chestamittal 1af94ccf6f
Update math/lcm_sum.cpp
Co-authored-by: Krishna Vedala <7001608+kvedala@users.noreply.github.com>
2020-10-21 22:15:06 +05:30
..
armstrong_number.cpp formatting source-code for ca70c3097e 2020-06-25 09:51:24 +00:00
binary_exponent.cpp Major rework to improve code quality and add automation checks (#805) 2020-06-19 21:34:56 +05:30
check_amicable_pair.cpp formatting source-code for 1d7a73ea58 2020-06-23 19:34:19 +00:00
check_factorial.cpp feat: added check_factorial (#1155) 2020-10-05 08:52:27 -04:00
check_prime.cpp Major rework to improve code quality and add automation checks (#805) 2020-06-19 21:34:56 +05:30
CMakeLists.txt Major rework to improve code quality and add automation checks (#805) 2020-06-19 21:34:56 +05:30
complex_numbers.cpp formatting source-code for 247301c5b5 2020-07-02 12:48:35 +00:00
double_factorial.cpp formatting source-code for e1b1c71e7c 2020-06-25 18:41:27 +00:00
eulers_totient_function.cpp Major rework to improve code quality and add automation checks (#805) 2020-06-19 21:34:56 +05:30
extended_euclid_algorithm.cpp Major rework to improve code quality and add automation checks (#805) 2020-06-19 21:34:56 +05:30
factorial.cpp Major rework to improve code quality and add automation checks (#805) 2020-06-19 21:34:56 +05:30
fast_power.cpp Major rework to improve code quality and add automation checks (#805) 2020-06-19 21:34:56 +05:30
fibonacci_fast.cpp formatting source-code for c7ff9d66f1 2020-06-24 17:14:57 +00:00
fibonacci_large.cpp Major rework to improve code quality and add automation checks (#805) 2020-06-19 21:34:56 +05:30
fibonacci.cpp fix: math/fibonacci linter warnings. (#1047) 2020-08-25 18:56:49 -05:00
gcd_iterative_euclidean.cpp Major rework to improve code quality and add automation checks (#805) 2020-06-19 21:34:56 +05:30
gcd_of_n_numbers.cpp Major rework to improve code quality and add automation checks (#805) 2020-06-19 21:34:56 +05:30
gcd_recursive_euclidean.cpp Major rework to improve code quality and add automation checks (#805) 2020-06-19 21:34:56 +05:30
large_factorial.cpp Major rework to improve code quality and add automation checks (#805) 2020-06-19 21:34:56 +05:30
large_number.h make multiplication 64-bit 2020-06-22 16:21:57 -04:00
lcm_sum.cpp Update math/lcm_sum.cpp 2020-10-21 22:15:06 +05:30
least_common_multiple.cpp fix: Integer overflow of least_common_multiple. (#970) 2020-07-22 08:01:06 -04:00
miller_rabin.cpp formatting source-code for a48d05fb62 2020-06-21 17:42:09 +00:00
modular_inverse_fermat_little_theorem.cpp Major rework to improve code quality and add automation checks (#805) 2020-06-19 21:34:56 +05:30
number_of_positive_divisors.cpp fix, test: simplification and tests for number_of_positive_divisors (#975) 2020-07-24 22:59:49 -04:00
power_for_huge_numbers.cpp Major rework to improve code quality and add automation checks (#805) 2020-06-19 21:34:56 +05:30
prime_factorization.cpp Major rework to improve code quality and add automation checks (#805) 2020-06-19 21:34:56 +05:30
prime_numbers.cpp Major rework to improve code quality and add automation checks (#805) 2020-06-19 21:34:56 +05:30
primes_up_to_billion.cpp fix: integer overflow due to multiplication fixed (#886) 2020-06-23 23:50:45 +05:30
README.md Major rework to improve code quality and add automation checks (#805) 2020-06-19 21:34:56 +05:30
realtime_stats.cpp fix: Various LGTM fixes 2020-06-23 15:13:28 -05:00
sieve_of_eratosthenes.cpp fix, test: Refactor of sieve_of_eratosthenes (#969) 2020-07-23 07:50:38 -04:00
sqrt_double.cpp Major rework to improve code quality and add automation checks (#805) 2020-06-19 21:34:56 +05:30
string_fibonacci.cpp Major rework to improve code quality and add automation checks (#805) 2020-06-19 21:34:56 +05:30
sum_of_digits.cpp formatting source-code for 9bc80876e8 2020-06-22 12:05:13 +00: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