Solve 231002 mod 41 using:
Modular exponentiation
n is our exponent = 1002
y = 1 and u ≡ 23 mod 41 = 23
See here
Since 1002 is even, we keep y = 1
u2 mod p = 232 mod 41
u2 mod p = 529 mod 41
529 mod 41 = 37
Reset u to this value
1002 ÷ 2 = 501
Since 501 is odd, calculate (y)(u) mod p
(y)(u) mod p = (1)(37) mod 41
(y)(u) mod p = 37 mod 41
37 mod 41 = 37
Reset y to this value
u2 mod p = 372 mod 41
u2 mod p = 1369 mod 41
1369 mod 41 = 16
Reset u to this value
501 ÷ 2 = 250
Since 250 is even, we keep y = 37
u2 mod p = 162 mod 41
u2 mod p = 256 mod 41
256 mod 41 = 10
Reset u to this value
250 ÷ 2 = 125
Since 125 is odd, calculate (y)(u) mod p
(y)(u) mod p = (37)(10) mod 41
(y)(u) mod p = 370 mod 41
370 mod 41 = 1
Reset y to this value
u2 mod p = 102 mod 41
u2 mod p = 100 mod 41
100 mod 41 = 18
Reset u to this value
125 ÷ 2 = 62
Since 62 is even, we keep y = 1
u2 mod p = 182 mod 41
u2 mod p = 324 mod 41
324 mod 41 = 37
Reset u to this value
62 ÷ 2 = 31
Since 31 is odd, calculate (y)(u) mod p
(y)(u) mod p = (1)(37) mod 41
(y)(u) mod p = 37 mod 41
37 mod 41 = 37
Reset y to this value
u2 mod p = 372 mod 41
u2 mod p = 1369 mod 41
1369 mod 41 = 16
Reset u to this value
31 ÷ 2 = 15
Since 15 is odd, calculate (y)(u) mod p
(y)(u) mod p = (37)(16) mod 41
(y)(u) mod p = 592 mod 41
592 mod 41 = 18
Reset y to this value
u2 mod p = 162 mod 41
u2 mod p = 256 mod 41
256 mod 41 = 10
Reset u to this value
15 ÷ 2 = 7
Since 7 is odd, calculate (y)(u) mod p
(y)(u) mod p = (18)(10) mod 41
(y)(u) mod p = 180 mod 41
180 mod 41 = 16
Reset y to this value
u2 mod p = 102 mod 41
u2 mod p = 100 mod 41
100 mod 41 = 18
Reset u to this value
7 ÷ 2 = 3
Since 3 is odd, calculate (y)(u) mod p
(y)(u) mod p = (16)(18) mod 41
(y)(u) mod p = 288 mod 41
288 mod 41 = 1
Reset y to this value
u2 mod p = 182 mod 41
u2 mod p = 324 mod 41
324 mod 41 = 37
Reset u to this value
3 ÷ 2 = 1
Since 1 is odd, calculate (y)(u) mod p
(y)(u) mod p = (1)(37) mod 41
(y)(u) mod p = 37 mod 41
37 mod 41 = 37
Reset y to this value
u2 mod p = 372 mod 41
u2 mod p = 1369 mod 41
1369 mod 41 = 16
Reset u to this value
1 ÷ 2 = 0
We have our answer