Read this article first . It contains what you want to do.
Then, work out the continuation of the dividend / dividend decomposition, and stop when you reach the required accuracy. You wonβt need a complete expensive division operation (I suppose it is O (n log ^ 2 n) or something like that), you only need integer division / remainder.
However, if BigInteger.Log returns a doubling, the exp (log a / log b) thing will work fine, and I think it might be faster than continuing the beat. You need two conversions to double (probably quickly), and accuracy is maintained throughout the operation (even if the logarithmic divider and the logarithmic dividend are very close to each other).
Alexandre C.
source share