Example of a power of 3 which is close to a power of 2 (Related to music theory and Superparticular ratios) I'm looking for a power of 3 close to a power of 2.
Let's say,
what is $(n,m)$ such that $$\left|\frac{2^n}{3^m}-1\right| = \min\left \{\left|\frac{2^i}{3^j}-1 \right|,  1\leq i,j\leq 20\right\} \quad ?$$
Why?
The idea is to understand the intervals between musical notes. Any link on this subject is welcomed (I don't know music theory but I'm interested).
 A: You want $2^i \approx 3^j$ with $i,j \in \mathbb N$
(preferably $1 \leq i,j \leq 20$).
Take the logarithm (in any base) of both sides: $$i \log(2) \approx j \log(3).$$
Thus the issue is now to obtain a good rational approximation
$$\underbrace{\dfrac{\log(3)}{\log(2)}}_{N}\approx \dfrac{i}{j}$$
Such rational approximations are obtained as the so-called "convergents" of the continued fraction expansion of number $N$ (https://en.wikipedia.org/wiki/Continued_fraction):
$$N=a_0+\tfrac{1}{a_1+\tfrac{1}{{a_2+\tfrac{1}{\cdots}}}}$$
with $(a_0; a_1, a_3, \cdots )=(1;1,1,2,2,3,1,5,2,23,2,2,1,55,1,...).$
with successive convergents:
$$ i/j = 3/2, \ 5/3, \ 8/5, \ 11/7, \ 19/12, \ 46/29, \ 65/41, \ 84/53, ...$$
$$317/200,\ 401/253, \ 485/306, \ 569/359, \ 1054/665...$$
(that can be found in (https://oeis.org/A254351/internal)).
Good convergents are obtained by (in plain terms) "stopping just before a big $a_k$".
If the "big $a_k$" (!) is 3, one gets :

$$\dfrac{19}{12} \approx 1.5833 \ \ \ \text{of} \ \ \ N = 1.5850...$$
Thus a good tradeoff is to take $i=19$ and $j=12$.

This is connected to the  "Pythagorician comma". (https://en.wikipedia.org/wiki/Pythagorean_comma).
Very related : (http://www.math.uwaterloo.ca/~mrubinst/tuning/12.html)
