Project Euler #122: Efficient exponentiation

  • + 0 comments

    Hope this is not spoiler on contest. I think it is not, but if admins think it is, feel free to delete.

    Gotta say the expert who did handpick the test cases must be some kind of evil genius. Thanks. Got me delving bit deeper into this, since you just happened to pick some cases where Donald Knuth's power tree method fails to create the most optimal chain. There are not many numbers below 10000 where this method fails for creating the optimum chain. Well, Knuth tells in his book what are the numbers. Method itself is blazingly fast.

    BUT. Can anyone elaborate WHY power tree method fails on these numbers? My understanding on subject is not enough. Tried to think about it and cant see the reason.