Quickest way to find prime factors of a number

12.2k Views Asked by At

I have this number 42900, that contains prime factors 2,2,3,3,5,5,11,13 But I got this by keep dividing until i got a prime factor.

3 * 143 * 100

3 * 143 * * 5 * 5 * 2 * 2

Then for 143, i had to start from 2 to 11 to get 11 * 13

Is there any easy way?

2

There are 2 best solutions below

4
On BEST ANSWER

since we have $$\sqrt{42900}=10\sqrt{429}$$ and $$\sqrt{429}<21$$ you must only try all primfactors until $$19$$

0
On

When you found $143$ as a factor, you did not need to repeat the small prime factors $2$ through $5$ already found. You could pick up with the next prime factor possibility $7$, checking up to $\sqrt{143}$ to be sure all are found.

The Wikipedia article gives some details on optimizing trial division, and it has been discussed here before.