Structures in the plot of the "squareness" of numbers
Solution 1:
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.