![]() |
Fastest way to prime factorize a number!! - Printable Version +- Post4VPS Forum | Free VPS Provider (https://post4vps.com) +-- Forum: Geek World (https://post4vps.com/Forum-Geek-World) +--- Forum: Scripting & Programming (https://post4vps.com/Forum-Scripting-Programming) +--- Thread: Fastest way to prime factorize a number!! (/Thread-Fastest-way-to-prime-factorize-a-number) |
Fastest way to prime factorize a number!! - thispc - 07-30-2016 a Modification to classic sieve of eratosthenes Code: #include<bits/stdc++.h> here small[i] array is smallest prime factor of given index i; It can be used to print all prime factors as follows:: Code: void printfact(int n,int small[]) Time::log n |