So why don't you have two functions?
- isPrimeNumber(n)
- findLowestDivisor(n)

It would
a) make the code more readable
b) allow you to test both functions separately

Which would then enable...