Add Chris's optimized expression for the asymptotic formula.
Fix some bugs in use of asymptotic formula (2N vs N mixup).
Fix some MSVC warnings.