why we use while(p*p<=m) if their is prime factor which is more then p then
Prime factorization
Ofcourse there can be a prime factor bigger than sqrt(m) but we have already covered it.
Consider m = 14.
Now while iterating for factors , let’s say i is a factor then m/i is also a factor.
SO when i is 2 we cover 14/2 ,i.e., 7 as well.
Proof :
Now if some prime p divides m and p > sqrt(m), then other factor has to be less than sqrt(m),
because for all p>sqrt(m), p*sqrt(m) > m
1 Like
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.