Given an integer M. return all prime numbers smaller than M.
Give a algorithm as good as you can. Need to consider time and space complexity.
π(n) count the primes less than or equal to n. Pafnuty Chebyshev has shown that if
limn→∞ π(n)/(n/ln(n))
exists, it is 1. There are a lot of values that are approximately equal to π(n) actually, as shown in the table.

It gives right number of prime number for this number format.I hope this will be helpful.