Project Euler Problem 7: Find 10001st prime number
One of the major problem I would like to address is performance.


When thinking about performance, the first question you should ask yourself is: could I use a better algorithm? Turns out there are better algorithms for generating primes, though they would be more difficult to implement (especially since they find all primes up to a certain number, which is not the same as finding the n-th prime).

It's probably not worth it in this case.


  An easy way to improve the performance would be to stop the fold when a prime number is found


You can use Seq.exists for that, which will also make your code simpler:

let isPrime x previousPrimes = not (Seq.exists (isDivibleBy x) previousPrimes)


(I'm using partial function application instead of a lambda, to make the code shorter.)



Other notes:

let isDivibleBy num denum = num % denum = 0


I think this function should be called isDivisibleBy.

match prime with
| true -&gt; …
| false -&gt; …


This is what if is for.

 getPrimesInternal count (num + 1) previousPrimes


If you start with num = 3 (and not 2), you can be sure that all primes that you test will be odd, so you can use num + 2 here, speeding up your code by about 50 %.