We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Is this going into the right direction?
What can you do if gcd(a, m) > 1
I tried using phi(m) in all cases, but I get incorrect results (as expected), but not reducing the size of the exponent, even if I do so, only when gcd > 1, still gets me timeouts.
Note: I already stop the recusion if m = 1;
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #188: The hyperexponentiation of a number
You are viewing a single comment's thread. Return to all comments →
https://github.com/retiman/project-euler/blob/bef367b700d350272707b728a99a69f83bb2eb99/strategies/problem-00188.txt
Is this going into the right direction? What can you do if gcd(a, m) > 1
I tried using phi(m) in all cases, but I get incorrect results (as expected), but not reducing the size of the exponent, even if I do so, only when gcd > 1, still gets me timeouts.
Note: I already stop the recusion if m = 1;