I am programming prime number generator (max 200 digits) in Pascal using the Miller–Rabin primality test.
I have already implemented multiple steps but I got stuck at the modular exponentiation part. I chose the Right-to-left binary method where (I assume) I have to implemenent A mod B where A and B are both (in worst case 200 digits). And to calculate the modulus I have to implement division of 2 numbers with max 200 digits. I respresent my long integers in an array where every element is a digit (0-9).
I have googled and I have not found any suitable algorithm for me (that would not take a lot of time to implement). So I am asking here if anyone has any experience with this. I doesnt have to be the fastest algorithm but it should not be "dumb" as euclidian divison that would take years and should be kind of easy to implement. I dont want do use any library (pure pascal)