Said I have the following expression: n = 39^50! mod 2251
By Fermat's Little Theorem: 39^2250 = 1 mod 2251
Solving:
2250 = 50.45
n = 39^50.49.48.47.46.45.44! mod 2251
Let b = 49.48.47.46.44! , then:
n = 39^50.45.b mod 2251
What I do next? I cannot use use the exponential division properties in modular operations (I think) which could be:
39^50.45.b / 39^50.45 = = 39^2250.b-2250 = 39^2250(b-1) so I could change the congruence to 1.
Generally, how do I solve this kind of expression?
I'm not sure what you mean by "how do I solve this kind of expression?", since you seem to have already solved this expression, but here is how I would write the solution:
$39^{50!}\bmod2251=$
$39^{44!\cdot45\cdot46\cdot47\cdot48\cdot49\cdot50}\bmod2251=$
$39^{45\cdot50\cdot44!\cdot46\cdot47\cdot48\cdot49}\bmod2251=$
$39^{2250\cdot44!\cdot46\cdot47\cdot48\cdot49}\bmod2251=$
$(\color\red{39^{2250}})^{44!\cdot46\cdot47\cdot48\cdot49}\bmod2251=$
$\color\red{1}^{44!\cdot46\cdot47\cdot48\cdot49}\bmod2251=$
$1\bmod2251=$
$1$
Or alternatively:
$39^{50!}\equiv$
$39^{44!\cdot45\cdot46\cdot47\cdot48\cdot49\cdot50}\equiv$
$39^{45\cdot50\cdot44!\cdot46\cdot47\cdot48\cdot49}\equiv$
$39^{2250\cdot44!\cdot46\cdot47\cdot48\cdot49}\equiv$
$(\color\red{39^{2250}})^{44!\cdot46\cdot47\cdot48\cdot49}\equiv$
$\color\red{1}^{44!\cdot46\cdot47\cdot48\cdot49}\equiv$
$1\pmod{2251}$