Since 41 is a prime, and 5 is prime to 41, therefore by Fermat's theorem
540=1(mod41)
By division algorithm,
2039=50.40+39
Therefore,
52039=550.40+39=(540)50.539
≡150.539(mod41)
≡539(mod41)
To calculate 539(mod41), we first calculate 539(mod41) where n=2,4,8,16,32
52≡25≡−16(mod41)
54≡256≡10(mod41)
58≡100≡18(mod41)
516≡324≡−4(mod41)
532≡16(mod41)
Now, 539≡532.54.52.5=16.10.(−16).5
≡33(mod41)
Thus 52039(mod41)=33