Minimum difference between $2^n$ and $3^m$ vs. $N$ where $N=n+m$ I'd like to know minimum difference $D$ as a function of $N$ where:
$D=|2^n-3^m|$
$N=n+m$
Just experimentally, it looks like $\ln D$ is linear with $N$, approximately:
$\ln{D}\approx0.425N$

For a given $N$, the minimum $D$ occurs at $n=\lfloor{N\over{1+{\log2\over{\log3}}}}\rfloor+1$ if $2^n-3^m$ is positive and $n=\lfloor{N\over{1+{\log2\over{\log3}}}}\rfloor$ if $2^n-3^m$ is negative.
A detail:

The red dots are where the minimum $2^n-3^m$ is negative, blue positive.
So there's slight amount of "noise" around that line so maybe an exact expression is unlikely, but is there a more formal way to derive this?
 A: Since $2^a = 3^b \iff a\ln 2 = b\ln 3$, under the constraint that $\nu + \mu = N$ we have $2^{\nu} = 3^{\mu}$ for $\nu = \frac{\ln 3}{\ln 6}N$ and $\mu = \frac{\ln 2}{\ln 6}N$. The smallest distance $\lvert 2^n - 3^m\rvert$ for $m,n$ integers with $n + m = N$ therefore occurs when $n = \lfloor \nu\rfloor$ or $n = \lceil \nu\rceil$. Writing $\delta = n - \nu$, we thus have $-1 < \delta < 1$ and
$$D = \lvert 2^n - 3^m\rvert = \lvert 2^{\nu + \delta} - 3^{\mu - \delta}\rvert = \exp \biggl( \frac{(\ln 2)(\ln 3)}{\ln 6}N\biggr)\cdot \lvert 2^{\delta} - 3^{-\delta}\rvert.$$
Thus
$$\ln D = \frac{(\ln 2)(\ln 3)}{\ln 6}N + \ln \lvert 2^{\delta} - 3^{-\delta}\rvert.$$
Since $C := \frac{(\ln 2)(\ln 3)}{\ln 6} \approx 0.4250012479336228$, the first term corresponds to your straight line, and that the exact values are close to that line is equivalent to $\delta$ not being too close to $0$. The inequality $\lvert \delta\rvert < 1$ implies $\lvert 2^{\delta} - 3^{-\delta}\rvert < 3^1 - 2^{-1} = \frac{5}{2}$, so $\ln D$ can never be much above that line. But $\delta$ can sometimes be very close to $0$. If $N$ is the denominator of a convergent of $\frac{\ln 3}{\ln 6}$, then
$$\biggl\lvert \frac{\ln 3}{\ln 6} - \frac{K}{N}\biggr\rvert < \frac{1}{N^2},$$
so $\lvert \nu - K\rvert < \frac{1}{N}$, hence $\lvert\delta\rvert < \frac{1}{N}$, and then
$$2^{\delta} - 3^{-\delta} = \exp(\delta\ln 2) - \exp (-\delta\ln 3) = \delta\ln 6 + O(\delta^2),$$
whence $\ln D \approx C\cdot N + \ln \delta < C\cdot N - \ln N$ in that case.
Of course a difference of $\approx \ln N$ is still small relative to $C\cdot N$. However, depending on the irrationality measure of $\frac{\ln 3}{\ln 6}$, there may be convergents where $\frac{K}{N}$ is much closer than $\frac{1}{N^2}$. If the irrationality measure is finite - and that's overwhelmingly likely - then the distance is bounded below by a power of $N$, and then we have $\lvert CN - \ln D\rvert \in O(\ln N)$. But if the irrationality measure is infinite, then $\lvert CN - \ln D\rvert$ can be of larger order than $\ln N$.
