I don’t understand when k becomes 3 and our i is also 3
then 3*3>=3 rt?
So, Why Prateek bhaiya is considering 3<=3 and calculating factor inside the loop. Technically, it should go outside the loop.
A factorial Problem
But in test expression it’s given i*i<=k right? not i<=k
yes here we are optimising the approach. like from O(N) to log(N).
if there is no factor till route(N) then there will be no factor afterwards.
That part I understood but in this question when the value of i becomes 3 and k also becomes 3.
So, ii<=k that means 33<=3 but this condition falis rt?
It should go out of the loop and it should be considered in if(k!=1) i.e (3!=1) then it’s a prime number.
Note:- I am factorizing 24.
it’s (i X i) in second line
you have doubt in which question? on the same which you have raised?
i will see the video and let you know if they are doing wrong.
Yes, I have raised the question in the same video “A factorial Problem”.
Any updates???
hey @div_yanshu07prateek bhaiya has clearly said in the video that ther can be one prime factor in the last which can be greater then i*i<=k because you can see if we do for 10 then in that we cannot check for number grater than 3 .
but till 3 on prime factor is 2 only and the number if not 1 so for that we have to check if the number after complete factorization also it is not 1 then you have to check if the number is not 1 then that leftover nummber will also be added to the prime factors.
just like in 10 5 will be added along with 2.
i hope i have cleare your doubt.
Happy Learning !!
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.