As many people will undoubtedly recognise, this is a question in a well known series of problems that I won't name ;)
It's been a long time since I've written any F# and I'm not sure I've ever come across any canonical style guidelines so I'd like feedback on all aspects of the code.
let largestPrimeFactor (number:int64) = let rec inner n current = if (n * n) > current then current else if current % n <> 0L then let nextCandidate = if n = 2L then 3L else n + 2L inner nextCandidate current else inner n (current / n) inner 2L number
Usage is simply:
let largestFactor = largestPrimeFactor 999999866000004473L // 999999937
I'm not really concerned with performance... I know about the various sieve options (Eratosthenes, Atkins) and decided that trial division for a single prime was adequate.