Project Euler #7: 10001st prime

  • Asked to answer
    + 1 comment

    A sieve typically is just a masking array that tells you if something is prime at a given index

    Indexes:  0,1,2,3,4,5,6,7...
       bits: [0,0,1,1,0,1,0,1...]
    

    So from this we'd know 2,3,5, and 7 are primes and so on up to the size of the sieve. Since your sieve was 10001 in length you would know all the primes numbers <= 10001, but not the first 10001 primes.

    The 10001th prime is greater than 10001 but less than 200000.