Least divisor of a number starting from a certain threshold So I'm going through The Haskell Road to Logic, Math, and Programming and for the first problem I am already really confused. This function LDF is supposed to be: 

LDF, for the least divisor starting from a given threshold k, with k <= n.

However, I feel like it does something else, since as implemented
ldf 8 16 will return 8 but ldf 7 16 will return 16.
Something must be wrong, or as I fear I am missing out on something. This is how the book implements the function.
ldf :: Integer -> Integer -> Integer
ldf k n | divides k n = k
        |k^2>n =n
        | otherwise = ldf (k+1) n

I modified the second line to be:
k > n = n
and now I get the results I expect, but I just want to make sure I am not missing something.

As noted by Daniel Fischer, the second clause is only correct if we know that no divisor of $n$ is smaller than $k$.
If we do not have this information, we can do a bit better than to replace it with:
| k > n = n
by noting that $2$ is the smallest prime number, so that no divisor of $n$ can be strictly between $\dfrac n 2$ and $n$. Therefore, a correct replacement for the second clause would be:
| 2*k > n = n
