Files
C-Plus-Plus/math
Vedant Mukhedkar f1ff652601 feat: Add memoized version of factorial (#2964)
* Create check_even_odd.cpp

Implementation to Check if a number is Even or Odd using Bitwise Operator

* Update check_even_odd.cpp

* Create factorial_top_down_dp.cpp

* Delete dynamic_programming/factorial_top_down_dp.cpp

Deleted the one file as there was 2 files in the commit

* Create factorial_top_down_dp.cpp

* Delete bit_manipulation/check_even_odd.cpp

* Update dynamic_programming/factorial_top_down_dp.cpp

Co-authored-by: realstealthninja <68815218+realstealthninja@users.noreply.github.com>

* Update dynamic_programming/factorial_top_down_dp.cpp

Co-authored-by: realstealthninja <68815218+realstealthninja@users.noreply.github.com>

* Update dynamic_programming/factorial_top_down_dp.cpp

Co-authored-by: realstealthninja <68815218+realstealthninja@users.noreply.github.com>

* Update factorial_top_down_dp.cpp

modified

* Update factorial_top_down_dp.cpp

added __uint128_t for handling  fixed-width integer types

* Create memoised_factorial.cpp

* Rename memoised_factorial.cpp to factorial_memoization.cpp

* Update factorial_memoization.cpp

* Delete dynamic_programming/factorial_top_down_dp.cpp

deleted the file from dp folder

* Update math/factorial_memoization.cpp

Co-authored-by: realstealthninja <68815218+realstealthninja@users.noreply.github.com>

* Update factorial_memoization.cpp

added cstdint header and switched to uint64 Thanks

* fix: wrap factorial functions under math namespace

* chore: add scope specifier in test cases

* doc: add documentation to headers

* doc: add defintion of memoisation as well as rewrite brief

---------

Co-authored-by: realstealthninja <68815218+realstealthninja@users.noreply.github.com>
2025-08-23 14:45:40 +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