Earlier quoted context omitted.
Is your algorithm published somewhere?
I literally just invented it, so it's not published yet, although I'll probably throw it up on GitHub at some point. It matches all published results up to an exponent of 3 billion or so, so I'm quite confident it's correct. The short explanation is that 2^x mod 10^k will repeat with a cycle length of 5^(k-1)*4. This is easily obtained from Euler's phi formula on 2^x mod 5^k, plus the fact that 2^x === 0 mod 2^k for…
It might actually not be too bad? The actual big integer arithmetic is written in some fast language, and Python is just the glue holding everything together.