Is the clustering of prime powers merely coincidental?

$2^3$ and $3^2$ are close together; $11^2$, $5^3$, and $2^7$ (121, 125, and 128) are close together; $3^5$, $2^8$, and maybe $17^2$ (243, 256, and 289) are close together. $7^3$ is close to $19^2$ (343 and 361). $3^7$ is very nearly $13^3$ (2187 and 2197), which is very nearly $47^2$ (2209). $19^4$ is close to $2^{17}$ (130,321 and 131,072). Further examples are easy to find.

One might expect coincidences to get farther apart and rarer as the numbers get larger, but that doesn't seem to happen. For example, $13^{11}$ and $23^9$ differ by about one part in 200 (1,792,160,394,037 and 1,801,152,661,463).

Is this all just the law of small numbers at work? How many such coincidences would one naïvely expect? Is there any evidence that the number of such coincidences is, or is not, more than one would naïvely expect? Is anything known about the distribution of prime powers?

-
It occurs to me that one should consider numbers of the form $n \log p$ instead of $p^n$. Each sequence of $n \log p$ for fixed $p$ is arithmetic, but with a different common difference than the other sequences. $$\qquad$$ As we go farther out, we are merging more and more of these sequences, so perhaps it's not surprising at all that the values get closer than any given $\epsilon$ more and more frequently.$$\qquad$$ I have more notes about this but they don't fix in the box. I'd still like to hear what other people have to say. –  MJD Mar 24 '12 at 21:26
Are you familiar with the abc conjecture? This would put some limits on how close prime powers can be. –  Gerry Myerson Mar 24 '12 at 21:44
As you observed, this is about $n\log p$ and $m\log q$ being close to each other. Or $n/m$ being close $\log q/\log p$, i.e. Diophantine approximation of $\log q/\log p$. I predict that people knowledgeable about that theory can give you sharp asymptotic results. As an example from music I list the small interval between seven octaves and twelve fifths, or $2^7$ vs. $(3/2)^{12}$. In the language of your question that is $2^{19}=524288$ vs. $3^{12}=531441$. You have found better examples already. –  Jyrki Lahtonen Mar 24 '12 at 21:50
@GerryMyerson: I was not familiar with the abc conjecture, but I read up on it last night. Do I understand correctly that your idea is that $a$ and $c$ will be prime powers and then the abc conjecture, if true, would bound how often rad(b) would be small? –  MJD Mar 28 '12 at 15:36
Yes, that's the idea. –  Gerry Myerson Mar 29 '12 at 5:49

For primes $p$ and $q$ the ratio $r=\log(p)/\log(q)$ is an irrational number and by the Equidistribution theorem the sequence $\{r,2r,3r,4r,\ldots\}$ is asymptotically equidistributed modulo 1.

Specifically, for large $N$ we would expect that $2\epsilon N$ elements of $\{i\cdot r\}_{i=1}^N$ are equivalent mod 1 to a number in the intervals $[0,\epsilon]\cap[1-\epsilon,1)$. This implies that $p^i$ is within a factor of $q^\epsilon$ of a power of $q$.

So if we look at powers of $p$ up to $N$ and want one to be within about 1 part in 200 of a power of $q$, approximately we want $\left|\log\left(p^a/q^b\right)\right|\le 0.005$, then we would expect to find $2N\log(1.005)/\log(q)$ close pairs.

Below are some charts showing this estimate and the actual number of pairs of exponents that give powers within 0.005 for pairs of primes $2\le p<q \le 29$. The x-axis enumerates the prime pairs, starting at $(2,3)$ and ending at $(23,29)$. The 17th entry showing a count of 2 in the first chart is $(3,17)$.

Note that the above argument does not rely on $p,q$ being primes, only that $\log(p)/\log(q)$ is irrational. Here are tables for $N=100$ and $N=10000$ for a few sets of primes as well as $(2,\pi)$ and $(\zeta(3),\mathrm{e})$.

$$\begin{array}{|c|c|ccc|} p & q & Best & |\log| & \#\{|\log|\le 0.005\} & Expected \\ \hline 2 & 3 & 2^{84} \sim 3^{53} & 0.0021 & 1 & 0.9 \\ 2 & 5 & 2^{65} \sim 5^{28} & 0.0097 & 0 & 0.6 \\ 5 & 13 & 5^{51} \sim 13^{32} & 0.0030 & 1 & 0.4 \\ 3 & 17 & 3^{49} \sim 17^{19} & 0.0009 & 2 & 0.4 \\ 13 & 17 & 13^{95} \sim 17^{86} & 0.0138 & 0 & 0.4 \\ 11 & 23 & 11^{17} \sim 23^{13} & 0.0028 & 1 & 0.3 \\ 17 & 29 & 17^{82} \sim 29^{69} & 0.0199 & 0 & 0.3 \\ 1229 & 1381 & 1229^{62} \sim 1381^{61} & 0.0009 & 1 & 0.1 \\ 2 & \pi & 2^{71} \sim \pi^{43} & 0.0099 & 0 & 0.9 \\ \zeta(3) & \mathrm{e} & \zeta(3)^{38} \sim \mathrm{e}^{7} & 0.0067 & 0 & 1.0 \\ \hline \end{array}$$

$$\begin{array}{|c|c|ccc|} p & q & Best & |\log| & \#\{|\log|\le 0.005\} & Expected \\ \hline 2 & 3 & 2^{1054} \sim 3^{665} & 0.00004 & 90 & 90.8 \\ 2 & 5 & 2^{9297} \sim 5^{4004} & 0.00006 & 62 & 62.0 \\ 5 & 13 & 5^{9551} \sim 13^{5993} & 0.000002 & 38 & 38.9 \\ 3 & 17 & 3^{5965} \sim 17^{2313} & 0.00016 & 37 & 35.2 \\ 13 & 17 & 13^{1637} \sim 17^{1482} & 0.00008 & 34 & 35.2 \\ 11 & 23 & 11^{4489} \sim 23^{3433} & 0.00024 & 30 & 31.8 \\ 17 & 29 & 17^{2875} \sim 29^{2419} & 0.00025 & 28 & 29.6 \\ 1229 & 1381 & 1229^{7813} \sim 1381^{7687} & 0.00012 & 16 & 13.8 \\ 2 & \pi & 2^{9217} \sim \pi^{5581} & 0.00007 & 86 & 87.1 \\ \zeta(3) & \mathrm{e} & \zeta(3)^{1641} \sim \mathrm{e}^{302} & 0.00008 & 98 & 99.8 \\ \hline \end{array}$$

It doesn't seem that the number of close pairs is more than expected. For $N=100$ and a 0.005 cutoff the average count is slightly less than we might expect from the asymptotics, but by $N=10000$ the observed match the model quite closely.

-
What a beautiful answer! –  Bruno Joyal Mar 29 '12 at 4:41
Thanks!......... –  Zander Mar 29 '12 at 13:03
I will probably accept this soon, but I would like to poke around with it a little more. I did not want you to think I had not seen and appreciated your answer, or that I had forgotten about it. Thanks. –  MJD Apr 13 '12 at 14:47
Thanks again for the effort you put into this answer. I am very grateful. –  MJD May 11 '12 at 1:05