Project Euler Q7 - 10001st prime
This computation is wrong:


let primeInner n =
 let numbers = seq {for i in 2..(int (sqrt (float n))) -&gt; i}
 numbers |&gt; Seq.forall (fun n1 -&gt; n % n1 = 0)



You need to invert the condition to n % n1 &lt;&gt; 0. Then you find a noticeable speed improvement of roughly 10x to the overall algorithm.

You should think of better names. isPrime instead of primeInner; findNth instead of nthPrimeInner.

A much prettier way is to filter an infinite sequence with isPrime and take the nth.

let nthPrime n =
  let isPrime n =
    seq {2..(int (sqrt (float n)))}
    |&gt; Seq.forall (fun n1 -&gt; n % n1 &lt;&gt; 0)

  let rec potentialPrimesFrom n =
    seq { yield n; yield! potentialPrimesFrom (n + 1) }

  potentialPrimesFrom 2
  |&gt; Seq.filter isPrime
  |&gt; Seq.nth n


This adds a little overhead, but you can get some of that back by applying nicer filters upfront to potentialPrimes

  let potentialPrimes =
    let rec oddFrom n = seq { yield n; yield! oddFrom (n+2) }
    seq { yield 2; yield! oddFrom 3 }

  potentialPrimes
  |&gt; Seq.filter isPrime
  |&gt; Seq.nth n


Rather than pushing performance further here, I would suggest rewriting to a more optimal algorithm like a Sieve of Eratosthenes.