Tag Info

New answers tagged


Many times you can solve this kind of problems using realtions such as GCD[a,b]=GCD[b,Mod[a,b]] and substituting conventional functions for modular ones more specialized. For example, instead of Mod[x^y,z] you have to use PowerMod[x,y,z] that works if z is not too big, even if x^y is huge. Coming back to your example and using different ...


We can take advantage of the fact that IntegerDigits is very fast when the base is large. But not too large: no bigger than $2^{63}-1$ on a 64-bit system or $2^{31}-1$ on a 32-bit one, because Mathematica's machine integers are signed. Additionally, non-power-of-two bases require more work to get the result than just partitioning a bit-string, and are ...

Top 50 recent answers are included