<jupyter_start><jupyter_text>By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.What is the 10 001st prime number?<jupyter_code>let compositesInRange fromNum toNum =
    [|2 .. toNum/fromNum|]
    |> Array.map (fun x -> fromNum * x)

let primesTo n =
    // start off assuming every number from 0 .. n is prime
    let isPrime = Array.init (1+n) (fun _ -> true)
    
    // simple sieve of eratosthenes - update "primeness" of
    // each number in the isPrime array
    for x in 2 .. int(sqrt(double(n))) do 
        if isPrime.[x] then             
            compositesInRange x n
            |> Array.map (fun i -> isPrime.[i] <- false)
            |> ignore
                
    // now return numbers which are "true" in isPrime array
    [|2..n|]
    |> Array.filter (fun x -> isPrime.[x])
    
// pick a big number, hopefully we have enough primes!!
let primes = primesTo 1000000   

primes.[10000]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1116751269035533, 'fraction_numerical': 0.03350253807106599, 'mean_word_length': 2.232786885245902, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '232133', 'license': 'MIT', 'n_tokens_mistral': 358, 'n_tokens_neox': 313, 'n_words': 117, 'path': 'Problem 007 - 10001st prime.ipynb', 'repo_name': 'smcl/ProjectEulerJupyter', 'size': '985'}