Skip to main content
3 of 3
added 2508 characters in body
Peter Taylor
  • 7.2k
  • 1
  • 21
  • 29

A brief comment on notation: "can be averaged by" is a reflexive partial order. I shall use the notation $a \succeq b$ to indicate that $a$ can be averaged by $b$, and save $\geq$ for the usual total order on the integers.


Another partial answer, this time with a positive proposition which I'm calling the three-pass lemma:

If $a = mn$, $\exists s < n: sm \succeq b$, and $\exists t < m: tn \succeq b$ then $a \succeq b$.

Proof proceeds by arranging the $a$ values in $m$ rows of $n$ values each and then performing three passes:

  1. Average the first $t$ rows, then the next $t$ rows, etc. If $tn \not\mid a$, finish by averaging the last $t$ rows. At the end of this pass, every row contains a single value repeated $n$ times.
  2. Average the first $s$ columns, then the next $s$ columns, etc. If $sm \not\mid a$, finish by averaging the last $s$ columns. At the end of this pass, there only two distinct values remain: the first $n-s$ columns have one value, and the last $s$ columns have another. (If $sm \mid a$ then only one distinct value remains and we can stop).
  3. Repeat the first pass. Each averaging operation of this pass takes the averaged positions to the target value.

Note that this proposition generalises your property 2 (take $m=p$, $n=a$, $s = \tfrac bp$, $t=1$) as well as your property 4 (take $m=n=y$, $s=t=x$).

Corollary:

Given $a$, we can find $b < a$ such that $b \preceq a$ iff $a$ is not squarefree.

Clearly if $a$ is squarefree then from $p \mid a \implies p \mid b$ the smallest predecessor of $a$ is itself. On the other hand, if $a = p^2 a'$ then we can take $m = p$, $n = pa'$, $s = a'$, $t = 1$, $b = pa'$ in the three-pass lemma. (This is also an instance of your property 2).


A similar notion of pass can be used for many $a, b$ to reduce to a single case that needs to be tested. Consider the following conditions:

  • $c \succeq b$
  • $d \succeq b$
  • $a = cq + r$ with $0 \le r < c$
  • $a = ds + t$ with $0 \le t < d$
  • $\tfrac{t-r}{q} \le c \bmod s \le \tfrac tq$

Then we can reduce the question of whether $a \stackrel?\succeq b$ to a single test vector as follows:

  1. Given an initial vector $\{u_1, \ldots, u_a\}$ we apply a pass of averages of size $c$ to reduce to $q+1$ clusters $\{v_1^c, v_2^c, \ldots, v_q^c, v_{q+1}^r\}$.
  2. We now apply a pass of $s$ averages of size $d$ where the input to each average is $\{v_1^{\left\lfloor c/s \right\rfloor}, v_2^{\left\lfloor c/s \right\rfloor}, \ldots, v_q^{\left\lfloor c/s \right\rfloor}, v_{q+1}^{d - q\left\lfloor c/s \right\rfloor} \}$
  3. That second pass creates one value $w_1$ with frequency $ds$. A final average of size $d$ which includes the $t$ values not equal to $w_1$ (and $w_1^{d-t}$) reduces to $\{w_1^{a-d}, w_2^d\}$, which by linearity is equivalent to $\{0^{a-d}, 1^d\}$. So if that latter test vector can be averaged, $a \succeq b$. (And, clearly, if it can't then $a \not\succeq b$).

The validity of step 2 depends on $q\left\lfloor \frac cs \right\rfloor \le d$; since $s\left\lfloor \frac cs \right\rfloor = c - (c \bmod s)$ this is equivalent to $$\begin{eqnarray*} cq - q(c \bmod s) &\le& ds \\ a - r - q(c \bmod s) &\le& a - t \\ t - r &\le& q(c \bmod s) \\ \end{eqnarray*}$$

We also require there to be sufficient $v_{q+1}$; i.e. $$\begin{eqnarray*} s(d - q\left\lfloor \frac cs \right\rfloor) &\le& r \\ ds - cq + q (c \bmod s) &\le& r \\ q (c \bmod s) &\le& t \\ \end{eqnarray*}$$

Combining the two, we see the necessity for the final precondition.


I've done a bit of experimentation with solving the test vectors produced by this reduction. If we consider the graph whose vertices are multisets of $a$ rationals and whose edges correspond to averaging $b$ values, solving a test vector is a pathfinding problem. However, the graph is infinite and most vertices have quite large out-degrees. The vertex priority which I've found most effective is to use Ilya Bogdanov's technique for normalising to a multiset of integers, and then prioritise the multisets with smallest maximum absolute value. Updated code and solutions will appear shortly on the gist I posted earlier in comments.

Peter Taylor
  • 7.2k
  • 1
  • 21
  • 29