I believe that it's a hard and very beautiful problem
Solution:
Let f(1,0)=f(0,1)=2,f(1,1)=f(0,f(1,0))=f(0,2)=3 and f(1,2)=f(0,f(1,1))=f(0,3)=4 so that f(1,x+1)=f(0,f(1,x))=1+f(1,x) then by using the induction f(1,x)=x+2.
Also we have f(2,0)=f(1,1)=3,f(2,1)=f(1,f(2,0))=f(1,3)=5 and f(2,2)=f(1,f(2,1))=f(1,5)=7 and we have f(2,x+1)=f(1,f(2,x))=2+f(2,x) then by using the induction we will have f(2,x)=2x+3.
For every x≥1,f(3,x)=f(2,f(3,x−1))=3+2f(3,x−1) then we can find the sequence of (an)n>0,an=f(3,n) such that for every n≥0 we have the recurrent equation an=3+2an−1.
So that
an=3+2an−1=3+2(3+2an−2)=3(1+2)+22(3+2an−3)=3(1+2+22)+23(3+2an−4)=...=3(1+2+22+...+2n−1)+2na0=3(2n−1)+2n×5=2n+3−3
Then f(3,1997)=22000−3