Balanced factors A non-square number cannot be factored to two identical factors. However, not all non-squares are equal: some of them can be factored to relatively close factors (for example, $6=2*3$), while others can be factored only to faraway factors (for example, $27=9*3$).
Formally, define a number $N$ as $R$-balanced (for $R \geq 1$), if it can be factored as $N=A*B$, such that $A \geq B$, and $A / B \leq R$. For example:


*

*$9=3*3$, therefore (like all other square numbers) is $1$-balanced, and also $2$-balanced, $3$-balanced, etc.

*$6=2*3$, therefore it is $1.5$-balanced, and also $2$-balanced, but not $1$-balanced.

*$27=9*3$, therefore it is $3$-balanced.

*$7=7*1$, therefore it is $7$-balanced (similarly, every prime number $p$ is $p$-balanced).


I am interested in the density of the balanced integers. Specifically:
A. Is there an asymptotic formula for the number of $R$-balanced integers smaller than $N$?


*

*For $R=1$, it is easy - the number of $1$-balanced integers smaller than $N$ is $\theta (\sqrt{N})$, so the density is $\theta (1/\sqrt{N})$, which goes to $0$ as $N$ goes to infinity. Is this also true for $R=2$? Is there an $R$ for which the density of $R$-balanced numbers becomes constant?


B. Is there an asymptotic formula for the distance between an integer $N$ and the closest $R$-balanced integer larger than $N$?


*

*For $R=1$, it is easy - the closest $1$-balanced integer larger than $N$ is $\lceil\sqrt{N}\rceil^2$, and the distance from $N$ is at most $2 \sqrt{N} + 1$, which goes to infinity as $N$ goes to infinity. Is this also true for $R=2$? Is there an $R$ for which the distance to the closest $R$-balanced number becomes constant?

 A: Note that this answer only addresses $R=2$, and only in a very approximate manner, but also addresses the question of whether or not the density of $R$-balanced integers is ever constant.
Consider a non-prime integer $K$ such that $K=pq$ for innermost factors $p$ and $q$. We can say that for each integer $K\ge2$ a number is $2$-balanced iff the innermost factors (factors nearest to $\sqrt{K}$) are within a distance of $p$ from one another. In other words, for a given factor $p$ the largest number $K$ that is $2$-balanced and contains $p$ as an innermost factor is $p*2p=2p^2$.
Therefore, we can enumerate the $2-balanced integers:
${1=(1*1), 2=(1*2), 4=(2*2), 6=(2*3), 8=(2*4), 9=(3*3), 12=(3*4), 15=(3*5), 18=(3*6), 16=(4*4),...}$
We can calculate the largest fully-$2$-balanced factor less than $K$. A factor $p$ is fully-$R$-balanced for upper-bound $K$ iff $Rp^2\le K$, or equivalently $p \le \sqrt{\frac{K}{R}}$. For $K=18$ we see that the largest fully-$2$-balanced factor is $3$. For the factors below this bound, there are $p+1$ numbers which are $2$-balanced. This gives us a total of $T(\lfloor \sqrt{K/2} \rfloor+1)$, where $T(n)$ is the nth triangular number.
For the factors above this bound, there are a steadily decreasing amount of $2$-balanced numbers. For each integer $\sqrt{K/2}<m\le \sqrt{K}$ there are $\lfloor K/m-m\rfloor +1$ $2$-balanced numbers that have $m$ as the smallest balanced factor. Note that this sum doesn't appear to be in OEIS, but regardless this sum appears oscillates around $K/10$ for large $K$ (I tested up to about $K=2500$).
Regardless of that sum, it doesn't really matter. $$\lim_{K\to\infty} \frac {T(\lfloor \sqrt(K/2)\rfloor +1)}{K}=\frac{1}{4}$$ the fully-$2$-balanced numbers approach a constant density: $\theta(1/4)$, and the density of $2$-balanced numbers appears to be roughly $3/10$
An interesting question would be what is the smallest $R$ such that the density of $R$-balanced integers is constant. It's clearly smaller than $2$.
