Finding Prime Factors of a number in $\log(n)$

1k Views Asked by At

Only Strategy I am aware of for finding factors efficiently is sieve of eratosthenes but from sieve I first have to pre-compute the prime numbers less than than $\sqrt{n}$. I want to skip this computation and implement an $O(\log(n))$ solution. Is there any such solution?

1

There are 1 best solutions below

2
On

No. As determining whether a number $n$ is prime is in $O(n)$, finding a prime factor is obviously also in $O(n)$.