# Structures in the plot of the “squareness” of numbers

Please explain the features of this plot of the squareness ratio $r(n)$ versus $n$.

I define the squareness of a natural number $n$ to be the closest its factors can be partitioned into a balanced ratio of $1$. A perfect square has squareness $1$. A prime $p$ has squareness $1/p$. In a sense, the squareness measures how close is $n$ to a perfect square.

Example. The squareness ratios for the first ten number $n=1,2,\ldots,10$ are $$1,\frac{1}{2},\frac{1}{3} ,1,\frac{1}{5},\frac{2}{3},\frac{1}{7},\frac{1}{2},1,\frac {2}{5}$$

Example. $n=1032 = 2 \cdot 2 \cdot 2 \cdot 3 \cdot 43$. One can partition its $5$ factors into two parts which have products whose ratios are $$\left\{\frac{1}{1032},\frac{1}{2 58},\frac{3}{344},\frac{2}{12 9},\frac{3}{86},\frac{8}{129} ,\frac{6}{43},\frac{24}{43}\right\}$$ with $\frac{24}{43} \approx 0.558$ the largest ratio, its squareness.

Example. For $n=12600=2 \cdot 2 \cdot 2 \cdot 3 \cdot 3 \cdot 5 \cdot 5 \cdot 7$, the largest ratio is $$\frac{3 \cdot 5 \cdot 7}{2^3 \cdot 3 \cdot 5}=\frac{7}{8}=0.875 \;.$$ Among this plot's evident features are: straight rays from the origin, hyperbolas, discernable density change at $r=\frac{1}{2}$, interesting patterns near $r=1$. There is more structure here than I anticipated.

(Some detail is lost converting the image for posting.)

Added. Riffing on PattuX's idea, for a prime, $n=p$, all the numbers $k n$ for $k=1,2,\ldots,p$ have squareness ratios $k/p$. For example, for $n=17$, $$n = 17,34,51,68,85,102,119,136,153 ,170,187,204,221,238,255,272, 289$$ have squareness $$\frac{1}{17},\frac{2}{17} ,\frac{3}{17},\frac{4}{17},\frac{5}{17},\frac{6}{17}, \frac{7}{17},\frac{8}{17},\frac{9} {17},\frac{10}{17},\frac{11}{ 17},\frac{12}{17},\frac{13}{1 7},\frac{14}{17},\frac{15}{17 },\frac{16}{17},1$$ and so all lie on a line through the origin.

• Cool! But what's the question? – Oiler Nov 19 '16 at 2:29
• @Oiler: What explains the several structural features of the plot? – Joseph O'Rourke Nov 19 '16 at 2:34
• I have posted a version of this question @MO here. – Joseph O'Rourke Nov 21 '16 at 0:07
• Hmmm... There is another famous idea, that also touches on number theory, that involves values with a real part of $1/2$. It's on the tip of my tongue... – Spencer Nov 22 '16 at 3:34
• I accepted a "solution" on MO here. – Joseph O'Rourke Nov 22 '16 at 10:43

Amazing stuff, very interesting.

If we say $r(x) = \frac{p}{q} < \frac{1}{a}$ and $a>b$, then $r(bx) = \frac{bp}{q}\space \space \space \space \space \space \space \space \space \space (a,b \in \mathbb{N})$

Proof: Assume $p=n_1 n_2 ... n_k, \space q=m_1 m_2 ... m_l$, so that $\frac{p}{q} \le1$ is maximal.

Then $\forall i,j:n_i<m_j \iff \frac{n_i}{m_j} < \frac{1}{a^{2}}$ because otherwise swapping $n_i$ and $m_j$ would result in $\frac{p}{q}$ incresing, but still be less than 1.

If we now say $p=bn_1 n_2 ... n_k, \space q=m_1 m_2 ... m_l$, we have to show that this is still optimal.

Assume $r(bx)\ne \frac{bp}{q} \implies \exists j: b<m_j, \frac{b}{m_j} \ge \frac{1}{a^{2}} \iff ba^{2}\ge m_j$

Swapping $b$ and $m_j$ effectivelty multiplies the fraction by $\frac{m_j^{2}}{b^{2}}$, therefore $\frac{m_j^{2}}{b^{2}} < a \implies m_j^{2}<b^{2}a$

Multiplying those together: $m_j^{3} < (ab)^{3} \implies m_j < ab < a^{2}$.

But we said that $\frac{n_i}{m_j} < \frac{1}{a^{2}}$. We can say $n_i = 1$ (as we didn't assume it is prime factorization), which yields $\frac{1}{m_j} < \frac{1}{a^{2}} \implies m_j > a^{2}$

[I'm not 100% sure this proof is correct, so please confirm this for yourself. However, even if it is not true for all numbers, it is true for most numbers, which is sufficient to create a pattern]

So $r(x)<\frac{1}{a} \implies r(bx) = b*r(x) \space \space \space (a>b)$. This may explain the partial linearity.

• Nice idea! I added an observation to the post using a variation of your idea. – Joseph O'Rourke Nov 19 '16 at 20:57
• Note that this does not only apply to primes. $r(23698) = \frac{2*41}{17*17} < 1/3$ for example gives $r(2*23698) = 2*r(23698)$ and $r(3*23698) = 3*r(23698)$. I'm not sure how whether fractions of the form $n/p$ or other fractions contribute more to this linear pattern. – PattuX Nov 20 '16 at 16:29
• Deleted my last comment as there was a mistake int my program... In the first 10000 numbers, when looking only at numbers with $r(x)<1/10$ there are: Prime divisors: 1225, composite divisors: 3796. I'm aware that I'm double counting, for example $r(23)=1/23$ and $r(46)=2/23$, as they are on the same line, but as lower ratios make a more dense line, I figured this might be fair. – PattuX Nov 20 '16 at 21:42
• The product of successive integers also gives intereting results as $r(n(n+1))= \frac{n}{n+1}$, whence these "hyperbolic" asymptotes near $r \approx 1.$ – Marc Bogaerts Nov 24 '16 at 19:07