There is a rounding formula that should make it possible to implement efficiently in inexact floating point arithmetic. (I think knuth gives a solution in TAOCP).
Also, depending on how you are accounting for the 'size of n', the iterative algorithm has time O(2^b) where b is the number of bits required to represent n and the closed form is O(b).