Quantum Computing, Quantum, Quantum Physics, Shors Algorithm, Qiskit.
Fortunately calculating: efficiently is possible. Classical computers can use an algorithm known as repeated squaring to calculate an exponential. In our case, since we are only dealing with exponentials of the form 2^j , the repeated squaring algorithm becomes very simple: def a2jmodN(a, j, N):