How to calculate the result only i.e. the number

for the equation:

Mod[sq(Mod[sq(Mod[sq(Mod[sq(Mod[14, 2^136279841-1])-2, 2^136279841-1])-2, 2^136279841-1])-2, 2^136279841-1])-2, 2^136279841-1]

What is sq?

Square of number. E.g. sq(2) = 4

sq[x_] := x*x;
Mod[
sq[Mod[
sq[Mod[
sq[Mod[
sq[Mod[14, 2^136279841 - 1]] - 2, 2^136279841 - 1]] - 2, 2^136279841 - 1]] - 2, 2^136279841 - 1]] - 2, 2^136279841 - 1]

Mod[Sqrt[
Mod[Sqrt[
Mod[Sqrt[
Mod[Sqrt[Mod[14, 2^136279841 - 1]] - 2, 2^136279841 - 1]] -
2, 2^136279841 - 1]] - 2, 2^136279841 - 1]] - 2,
2^136279841 - 1]
% // N

If sq means simply square, then the result is 2005956546822746114

The code looks like a trick code because the inner Mod[] has a simple result equal to 14 :wink:

We can compute manually the result:

14^2 - 2 = 194
194^2-2 = 37634
37634^2 - 2 = 1416317954
1416317954^2 - 2 = 2005956546822746114

The code itself looks like this:

Mod[
 Mod[Mod[Mod[Mod[14, 2^136279841 - 1]^2 - 2, 2^136279841 - 1]^2 - 2, 
     2^136279841 - 1]^2 - 2, 2^136279841 - 1]^2 - 2, 2^136279841 - 1]

If sq means square root, then the code presented by Gianluca seems to be the right:

Mod[Sqrt[
  Mod[Sqrt[
     Mod[Sqrt[
       Mod[Sqrt[Mod[14, 2^136279841 - 1]] - 2, 2^136279841 - 1]] - 2, 
      2^136279841 - 1]] - 2, 2^136279841 - 1] - 2], 2^136279841 - 1] //
  N