The author’s proposed solution only works up to n = 78. If you want to speed up the calculation for small values, just cache them all.
Personally I don’t ever want a compiler trying to replace straight-forward integer algorithms with floating point formulas. YMMV.
The author’s proposed solution only works up to n = 78. If you want to speed up the calculation for small values, just cache them all.