The decimal representation of $m/n,$ where $m$ and $n$ are relatively prime positive integers and $m < n,$ contains the digits 2, 7, and 1 consecutively, and in that order. Find the smallest value of $n$ for which this is possible.
We may assume the decimal starts $0.271\ldots$, i.e.\ $\frac{271}{1000}\le\frac mn<\frac{272}{1000}$, after shifting by a power of $10$ (which replaces $m$ by $10^km\bmod n$).
For each $n$ we need some residue $r$ with $0.271\le\frac rn<0.272$.
This first happens at $n=59$, with $\frac{16}{59}=0.27118\ldots$.