Miler Robin Algo and Fast Exponential modulus

We tried to implement the code for programming problems given in the book Stallings, William - Cryptography and network security principles and practice-Pearson (2017) chapter 2.

2.1 Write a computer program that implements fast exponentiation (successive squaring) modulo n.

2.2 Write a computer program that implements the Miller–Rabin algorithm for a userspecified n. The program should allow the user two choices: (1) specify a possible witness a to test using the Witness procedure or (2) specify a number s of random witnesses for the Miller–Rabin test to check.