Calculate 5^2039(mod 41)
Here I don't know if it helps but it looks like the same problem your asking here you go hope it helps! https://kvmalkapuramlibrary.files.wordpress.com/2014/09/question-bank-solutions.pdf