Prime factorization (using sieve)

here we finding prime factors till the square root of a number . suppose that the number is 14 . its square root is 3.74 , but it has 7 as its prime factor which is greater than 3.74 . please help , am not getting the idea

hi @gulatigarvita08

all numbers greater than sqrt(n) will be crossed by no less than sqrt(n)

for n=14 sqrt(n)=3

2 3 4 5 6 7 8 9 10 11 12 13 14
first we mark multiple of 2
so nos remain
2 3 5 7 9 11 13
now mark multiple of next non marked no which is 3
2 3 5 7 11 13
hence all nos remaining are prime no need to go till n
if we iterate till sqrt(n) it will work

i hope this help
if you have more doubts regarding this feel free to ask
if your doubt is resolved mark it as resolved from your doubt section inside your course