mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
f7d656cb17
* Add inverse inverse root function Add inverse inverse root function Signed-off-by: Bensuperpc <bensuperpc@gmail.com> * Update comment Update comment Signed-off-by: Bensuperpc <bensuperpc@gmail.com> * Update math/inv_sqrt.cpp Change to IO operations Co-authored-by: David Leal <halfpacho@gmail.com> * Update math/inv_sqrt.cpp Update comment Co-authored-by: David Leal <halfpacho@gmail.com> * Update math/inv_sqrt.cpp Update comment Co-authored-by: David Leal <halfpacho@gmail.com> * Update math/inv_sqrt.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * Update math/inv_sqrt.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * Fix fist warning Fix fist warning Signed-off-by: Bensuperpc <bensuperpc@gmail.com> * Fix warning N2 Fix warning N2 Signed-off-by: Bensuperpc <bensuperpc@gmail.com> * Fix warning N3 Fix warning N3 Signed-off-by: Bensuperpc <bensuperpc@gmail.com> * Fix warning N4 Fix warning N4 Signed-off-by: Bensuperpc <bensuperpc@gmail.com> * updating DIRECTORY.md * Update math/inv_sqrt.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * Update math/inv_sqrt.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * Update math/inv_sqrt.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * clang-format and clang-tidy fixes for 1acc7773 * Update math/inv_sqrt.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * Update math/inv_sqrt.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * Add tests and improve comment Add tests and improve comment Signed-off-by: Bensuperpc <bensuperpc@gmail.com> * Update math/inv_sqrt.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * Add default template type (double) Add default template type (double) Signed-off-by: Bensuperpc <bensuperpc@gmail.com> * Update comment Update comment Signed-off-by: Bensuperpc <bensuperpc@gmail.com> * Update math/inv_sqrt.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * Add comments Add comments Signed-off-by: Bensuperpc <bensuperpc@gmail.com> * updating DIRECTORY.md Co-authored-by: David Leal <halfpacho@gmail.com> Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
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