Fastest way to find all the divisors of a large number
问题 I am facing a problem when I want to get all the divisors of a large number i.e n=10^12. There is a method, which checks all possible numbers less than square root of given number n. for(int i=1; i<=sqrt(n); ++i){ if(n%i==0){ factors.push_back(i); if(i!=n/i) factors.push_back(n/i); } } But when n is very large i.e 10^12 then it needs 10^6 iterations which is very slow. Is there any faster way when I have all prime divisors of given n such as given number is 48. Then prime factorization of 720