I know there are tons of way of doing it and the best solution that i have found is the recursive method of Kupala(a youtuber, u can check it on youtube). Well, i could say that this way is 50 percent successful but the number that it can compute is still very far from 2 billion. I checked the result using this website: https://www.mtholyoke.edu/courses/quenell/s2003/ma139/js/powermod.html I just wanna ask if there is any other way that can possibly reach this number? My programming language that i use is C++. Here is the code:
int emod(int a, int b, int c)
{
if(b==1)
{
return remainder(a,c);
}
if(b%2==0)
{
return remainder((emod(a,b/2,c)*emod(a,b/2,c)),c);
}else if(b%2!=0)
{
return remainder(fmod(a,c)*emod(a,b-1,c),c);
}
}