Space problem with Sieve of eratosthenes?

  • 0

    In Sieve of eratosthenes we have to first create an array of n elements to find all prime till n. What happen if n is very big (say 10^18) . Then this much memory may not available. So, how to solve such kind of problem using Sieve of eratosthenes.

  • -1

    You Can take boolean array of size n, that way you can simply mark the number using 1 bit

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.