@va1ts7_100
We need to find prime numbers only up to square root of ‘n’ because any composite number beyond this will already be crossed off. This’ll leave you with only primes between square root n and n.
Best thing to do, pick an example!
Say n =40. Square root n, rounded down to closest integer, 6.
1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30
31 32 33 34 35 36 37 38 39 40
Rule: pick the first prime number, cross off multiples of that number. And continue. Until prime number reaches sqrt n (here, 6).
Crossed numbers:
2: all even numbers
3: 9,15,21,27,33,39
5: 25, 35
Remaining uncrossed: 2, 3, 5,7, 11,13,17,19,23,29,31,37
Point to ponder: why did I not pick up 7 ( 7 being greater than square root 40)??
Multiples of 7 lesser than 40 are 14, 21, 28, 35. Which are multiples of 2,3,4&5, all of which have already been crossed off.
There you go!