<s>[INST] A strange "pattern" in the continued fraction convergents of pi? From the simple continued fraction of $\pi$, one gets the convergents,
$$p_n = \frac{3}{1}, \frac{22}{7}, \frac{333}{106}, \frac{355}{113}, \frac{103993}{33102}, \frac{104348}{33215}, \frac{208341}{66317}, \frac{312689}{99532}, \frac{833719}{265381}, \frac{1146408}{364913}, \dots,$$
starting with $n=1$, where the numerators and denominators are A002485 and A002486, respectively. If you stare at it hard enough, a pattern will emerge between three consecutive convergents. Define,
$$\left(a_n,\,b_n,\,c_n\right) = \left(p_{n}-3,\;\; p_{n+1}-3,\;\; p_{n+2}-3\right),$$
$$v_n=\text{Numerator}\,(a_n)\,\text{Numerator}\,(b_n).$$
Then, for even $n \ge 2$,
$$F(n) = \sqrt{\frac{a_n c_n}{a_n-c_n}-v_n}\in\mathbb{Z}\text{ (often)}.$$
For example, for $n = 2$,
$$\left(a_2,\,b_2,\,c_2\right) = \left(\frac{22}{7}-3,\; \frac{333}{106}-3,\; \frac{355}{113}-3\right),$$
$$F(2) = 1.$$
More generally,
$$\begin{array}{cc}
n&F(n) \\
2&1 \\ 
4&16\\
6&4703\\
8&14093\\ 
10&51669\\
12&122126\sqrt{2}\\
14&7468474\\ 
16&\frac{18549059}{\sqrt{2}}\\
\end{array}$$
and so on. For even $n<100$, I found half of the $F(n)$ were either integer or half-integer. (And all the non-integers were of form $N\sqrt{d}$ for some very small d.)
Some questions:


*

*For $n<500$, $n<1000$, etc, how many $F(n)$ are integers or half-integers?

*More importantly, why is $F(n)$ often an integer?

 [/INST] The $q_n = p_n-3$ are the convergent fractions of $\pi-3$ (it really doesn't matter to do this change by the way, you could have started straight from $\pi$, only by picking $n \ge 3$ odd instead of $n \ge 2$ even)
3 consecutive convergent fractions are of the form $\frac ab, \frac cd, \frac{a+kc}{b+kd}$ for some integers $a,b,c,d,k$ and $ad-bc=1$ (because we picked $n$ even).
$F(n) = \sqrt{\frac {a(a+kc)}{a(b+kd)-b(a+kc)}-ac} = \sqrt{\frac{a^2+kac}k-ac} = a/\sqrt k$
From the wikipedia page of $\pi$ I can only see the first $3$ relevant $k$, and they are all $1$, so $F(n) = numerator(a_n)$ for $n=2,4,6$ at least.
</s>