Graham's number G\$G\$ is defined in this way:
u(3,n,1) = 3^n u(3,1,m) = 3 u(3,n,m) = u(3,u(3,n-1,m),m-1) [Knuth's up-arrow notation] [Conway chained arrow notation] THEN g1 = u(3,3,4) g2 = u(3,3,g1) g3 = u(3,3,g2) ... G = u(3,3,g63) \begin{align*} u(3,n,1) & = 3^n \\ u(3,1,m) & = 3 \\ u(3,n,m) & = u(3,u(3,n-1,m),m-1) \end{align*}
Then,
\begin{align*} g_1 & = u(3,3,4) \\ g_2 & = u(3,3,g_1) \\ g_3 & = u(3,3,g_2) \\ & \vdots \\ G & = u(3,3,g_{63}) \end{align*}
You are given that u(3,3,2)=7625597484987\$u(3,3,2)=7625597484987\$ to check your code.
Your task is to write a program/function that will output the value of G\$G\$ deterministically, given enough integer size and enough time.