in reply to Efficiently working with huge exponents

Not quite what you asked, but how about transforming the problem domain and using logarithms? It's monotonic increasing, so the sort order remains the same. Different bases are scaled by an easily calculated factor and if you need the big integer, then you leave the calculation to the end.

Sometimes I can think of 6 impossible LDAP attributes before breakfast.
  • Comment on Re: Efficiently working with huge exponents

Replies are listed 'Best First'.
Re^2: Efficiently working with huge exponents
by wanna_code_perl (Friar) on Mar 20, 2015 at 12:22 UTC

    I thought of this as well, but I still need to be able to perform other arithmetic operations on the result, such as addition, multiplication, and even further exponentiation. Plus if I do $n->blog(10) to get the base-10 exponent, I still have to wait out the 3-minute calculation of $n in the first place, or maybe there's some clever math that I learned too many decades ago that would help. :-)