Prime factorization using sieve

can u explain this problem using example

hi @divisharoy14_5d0aa86c37c6588a, I hope u r clear with generating prime using sieve…
Coming to ur ques.
suppose your number is 28 then you’ll start from dividing with first prime i.e 2, its divisible so u push 2 and start reducing, reduce to 14 again to 7 now check with next prime as it not div by 2 so now 3 comes and 3*3 <= 7 this fails so it comes out of while loop and since m is not -1 so u push 7 also

finally u get 2 and 7 as ans

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.

1 Like