Is $22/7$ the closest to $\pi$, among fractions of denominator at most $50$?
There is a distinction between best approximation and closest approximation to a real number. Any standard text in Number Theory that contains a chapter on Continued Fractions tells you that best approximations to $\alpha \in \mathbb R$ are the convergents to $\alpha$. What is being asked here are what one may call the closest approximations to $\alpha$.
Let $\alpha \in \mathbb R$. We write $\{\alpha\}=\alpha - \lfloor \alpha \rfloor$ denote the fractional part of $\alpha$. Note that $0 \le \{\alpha\}<1$, and that $\{\alpha\}=0 \Leftrightarrow \alpha \in \mathbb Z$.
By $||\alpha||$ we mean $\min \big\{ \{\alpha\}, 1-\{\alpha\}\big\}=\min \big\{|\alpha -n|: n \in \mathbb Z\}$; this denotes the “distance” of $\alpha$ from its nearest integer. Note that $0 \le ||\alpha|| \le \frac{1}{2}$, and that $||\alpha||=0 \Leftrightarrow \alpha \in \mathbb Z$.
Definition 1. We say $\frac{p}{q} \in \mathbb Q$, $q \in \mathbb N$, is a best approximation to $\alpha$ if
$(i)$ $q=1$, $p$ is the integer nearest $\alpha$, or
$(ii)$ $q>1$, and $||q\alpha|| = \min\big\{||n\alpha||: 1 \le n \le q \big\}$, $p$ is the integer nearest $q\alpha$.
This leads to a unique infinite sequence of rational numbers $\frac{p_0}{q_0}, \frac{p_1}{q_1}, \frac{p_2}{q_2}, \ldots $ that yield all best approximations to a fixed $\alpha \in \mathbb R$, with $1=q_0<q_1<q_2<\ldots$ . This sequence is precisely the sequence of $“$convergents$”$ to $\alpha$.
Definition 2. We say $\frac{p}{q} \in \mathbb Q$, $q \in \mathbb N$, is a closest approximation to $\alpha$ if
$(i)$ $q=1$, $p$ is the integer nearest $\alpha$, or
$(ii)$ $q>1$, and
$\left|\alpha - \frac{p}{q} \right| = \frac{1}{q}||q\alpha|| = \min\big\{||\alpha - \frac{m}{n}||: 1 \le n \le q \big\}$, $p$ is the integer nearest $q\alpha$.
This leads to a unique infinite sequence of rational numbers $\frac{p_0}{q_0}, \frac{p_1}{q_1}, \frac{p_2}{q_2}, \ldots $ that yield all closest approximations to a fixed $\alpha \in \mathbb R$, with $1=q_0<q_1<q_2<\ldots$ . This sequence contains the sequence of $“$convergents$”$ to $\alpha$.
I include a table of both best approximations and closest approximations to $\pi$ to several digits of approximation. This is taken from a table in one of my publications.
Closest and Best Approximations to $\pi = \big[3,7,15,1,292,1,1,1,2,1,\ldots \big]$
$$ \begin{array}{|c|c|c|c|} \hline p & q & \frac{1}{q}\,||q{\pi}|| & ||q{\pi}|| \\ \hline 3 & 1 & 0.141592653590\,\cdots & 0.141592653590\,\cdots \\ \hline 13 & 4 & 0.108407346410\,\cdots \\ \hline 16 & 5 & 0.058407346410\,\cdots \\ \hline 19 & 6 & 0.025074013077\,\cdots \\ \hline 22 & 7 & 0.008851424871\,\cdots & 0.001264489267\,\cdots \\ \hline 179 & 57 & 0.001241776397\,\cdots \\ \hline 201 & 64 & 0.000967653590\,\cdots \\ \hline 223 & 71 & 0.000747583167\,\cdots \\ \hline 245 & 78 & 0.000567012564\,\cdots \\ \hline 267 & 85 & 0.000416183002\,\cdots \\ \hline 289 & 92 & 0.000288305764\,\cdots \\ \hline 311 & 99 & 0.000178512176\,\cdots \\ \hline 333 & 106 & 0.008821280518\,\cdots & 0.000083219628\,\cdots \\ \hline 355 & 113 & 0.000030144354\,\cdots & 0.000000266764\,\cdots \\ \hline 52163 & 16604 & 0.000000266213\,\cdots \\ \hline 52518 & 16717 & 0.000000262611\,\cdots \\ \hline 52873 & 16830 & 0.000000259056\,\cdots \\ \hline 53228 & 16943 & 0.000000255549\,\cdots \\ \hline 53583 & 17056 & 0.000000252089\,\cdots \\ \hline \vdots & \vdots & \vdots & \vdots \\ \hline 102573 & 32650 & 0.000000004279\,\cdots \\ \hline 102928 & 32763 & 0.000000003344\,\cdots \\ \hline 103283 & 32876 & 0.000000002416\,\cdots \\ \hline 103638 & 32989 & 0.000000001494\,\cdots \\ \hline 103993 & 33102 & 0.000019129233\,\cdots & 0.000000000578\,\cdots \\ \hline \end{array} $$
According to this table, the complete sequence of rational numbers with both numerator and denominator less than or equal to $1000$ that increasingly get closer to $\pi$ is given by
$$ \frac{3}{1}, \frac{13}{4}, \frac{16}{5}, \frac{19}{6}, \frac{22}{7}, \frac{179}{57}, \frac{201}{64}, \frac{223}{71}, \frac{245}{78}, \frac{267}{85}, \frac{289}{92}, \frac{311}{99}, \frac{333}{106}, \frac{355}{113} $$
The next rational number that is closer to $\pi$ is $\frac{52163}{16604}$.
It is straightforward to check each possible denominator one by one. The sequence of best approximations starts $$3, \frac{13}{4}, \frac{16}{5}, \frac{19}{6}, \frac{22}{7}, \frac{179}{57}, \frac{201}{64}, \frac{223}{71}, \frac{245}{78}, \frac{267}{85}, \frac{289}{92}, \frac{311}{99}, \frac{333}{106}, \frac{355}{113}$$
See OEIS sequences A063673 and A063674.
(1). If $a,b,c,d\in \Bbb N$ with $|ad-bc|=1$ then $(ma+nc)/(mb+nd)$ is in lowest terms whenever $m,n\in \Bbb N$ with $\gcd(m,n)=1,$ and every rational between $a/b$ and $c/d$ is equal to $(ma+nc)/(mb+nd)$ for some co-prime $m,n \in \Bbb N.$
(2). Let $\delta=3+1/7 -\pi.$ We have $3+1/8 <\pi-\delta<\pi< \pi+\delta=3+1/7.$
If $q\in \Bbb Q$ and $|\pi-q|<\delta$ then $1/8<q-3<1/7$ so by (1), for some $m,n \in \Bbb N$ with $\gcd(m,n)=1$ we have $1/7 -2\delta <q-3=(m+n)/(8m+7n).$
This implies $0<1/7 -(m+n)/(8m+7n)<2\delta$ and hence $7n>m(-8+1/14\delta).$ Since $1/14\delta>56,$ this implies $7n>48m\ge 48,$ so $n\ge 7.$
So by (1) the lowest-terms denominator for $q,$ which is $8m+7n,$ is at least $8(1)+7(7)=57.$
BTW. $\pi-\delta<3+8/57<\pi.$