[Math] Let the rational number $p/q$ be closest to but not equal to $22/7$ among all rational numbers with denominator $< 100$.

fractionsirrational-numbersrational numbers

Let the rational number $p/q$ be closest to but not equal to $22/7$ among all rational numbers with denominator $< 100$. What is the value of $p − 3q$ ?

My approach: $22/7=3.14$, therefore, $p/q=314/100$ but according to the question p/q has a denominator that's less than $100$ satisfying which $p/q$ can be $157/50$. But the given closest value is $22/7$. Hence I concluded that $p/q=313/100$ which gave me the answer as $13$. However, the answer key says it's $14$. Where am I going wrong? Is it because I'm taking it up to $2$ decimal places?

Best Answer

$$\left|\frac pq-\frac{22}7\right|=\left|\frac{7p-22q}{7q}\right|$$

The point is to solve the Diophantine equation $$7p-22q=\pm1$$ and get the greatest possible value for $q$.

It turns out that $7\cdot 311-22\cdot99=-1$, so your fraction is $\frac{311}{99}$

Related Question