I am trying to build a C++ program that can solve the modular congruence:
n^p = x (mod q ),
where n is a small number, and p and q are very large arbitrary primes. I've tried to do this multiple times, but I always run into memory overflow issues. Any help is appreciated.