Generally, let Sn be the number of 2n-tuple (p1,p2,…,pn;q1,q2,…,qn) of positive integers with p1=qn=1 and pi+1qi−piqi+1=1 for all i=1,2,…,n−1. We use semicolons to make the boundary simple.
Let (p1,p2,…,pn;q1,q2,…,qn) a tuple with the desired conditions. We first prove that there uniquely exists i such that pi=qi=1.
Assume that there does not exist such i. Then q1=1 and pn=1.
Since the sequence pj/qj is increasing, there exists j such that
qjpj<1<qj+1pj+1.
But then
qj+1pj+1−qjpj≥qj+11+qj1≥qjqj+12,
hence pj+1qj−pjqj+1≥2, a contradiction. So there exists i such that pi=qi=1. Uniqueness is clear.
Now we consider the number of tuples which meets the condition for fixed i such that pi=qi=1.
(1) Case i=1:
Assume that (1,p2,…,pn;1,q2,…,qn) meets the condition. Let pj′=pj−qj. Then the 2(n−1)-tuple (p2′,p3′,…,pn−1′;q2,q3,…,qn) meets the condition.
Conversely, assume that a 2(n−1)-tuple (p1,…,pn−1;q1,…,qn−1) meets the condition. Let pj′=pj+qj. Then (1,p1′,p2′,…,pn−1′;1,q1,q2,…,qn−1) meets the condition.
Since each of these two operations gives the inverse of the other, it follows that the number of 2n-tuples with p1=q1=1 which meets the condition is equal to Sn−1.
(2) Case 1<i<n:
Assume that (p1,…,pi−1,1,pi+1,…,pn;q1,…,qi−1,1,qi+1,…,qn) meets the condition. Let qj′=qj−pj and pj′′=pj−qj. Then two tuples (p1,…,pi−1;q1′,…,qi−1′) and (pi+1′′,…,pn′′;qi+1,…,qn) meet the condition.
Conversely, assume that a 2(i−1)-tuple (p1,…,pi−1;q1,…,qi−1) and a 2(n−i)-tuple (p~1,…,p~n−i;q~1,…,q~n−i) meet the condition. Let qj′=pj+qj and p~j′′=p~j+q~j. Then (p1,…,pi−1,1,p~1′′,…,p~n−i′′;q1′,…,qi−1′,1,q~1,…,q~n−i) meets the condition.
Since each of these two operations gives the inverse of the other, it follows that the number of 2n-tuples with pi=qi=1 which meets the condition is equal to Si−1Sn−i.
(3) Case i=n:
Thinking similarly to the case i=1, the number of 2n-tuples with pn=qn=1 which meets the condition is equal to Sn−1.
From arguments above, we obtain a recursive relation
Sn=Sn−1+S1Sn−2+⋯+Sn−2S1+Sn−1.
With this formula and the initial value S1=1, we can compute and get S10=16796.