Monday, September 25, 2023

Enumeration of triambuses? Rhombangles?

Earlier this month, I watched La Vuelta, one of the three grand tours of cycling (a trio that includes the Tour de France). I noticed the peloton—the main group of riders—took on an aerodynamic profile that sometimes looked like a triangle, sometimes looked like a rhombus, and sometimes looked somewhere in between.

For example, the figure below shows the four possible formations between a triangle and a rhombus when the peloton’s maximum width is four riders:

For certain numbers of riders, multiple formations like these are possible. In particular, there are two formations with 15 riders: a triangle that’s five riders wide at the base and an almost-rhombus that’s four riders wide in the middle, but missing the bottommost rider, as shown below.

After 15, what is the next smallest number of riders that similarly has two distinct formations between a triangle and a rhombus?

Taking a hint from the formations for $N=15$ riders, let's try to find the formula for all number of riders that have two formations between a triangle and a rhombus where one formation is a triangle and the other has one more row. Let's denote these numbers as $N_k^{(1)}.$ Let's start with a triangle with $n$ rows, then we could get one triangle of $n+k$ rows, and another formation by adding $k+1$ rows of descending length, from $n-1$ through $n-k-1.$ In this case, in the first formation, there are $\sum_{i=1}^k (n+i) = kn + \frac{k(k+1)}{2}$ riders added beyond the initial triangle. In the second formation, there are $\sum_{i=1}^{k+1} (n-i) = (k+1)n - \frac{(k+1)(k+2)}{2}$ additional riders. In this case we can then solve for $n$ in terms of $k$ to see that $$kn + \frac{k(k+1)}{2} = (k+1)n - \frac{(k+1)(k+2)}{2} \Rightarrow n = \frac{k(k+1)}{2} + \frac{(k+1)(k+2)}{2} = (k+1)^2.$$ Thus, for any $k \in \mathbb{N},$ $N_k^{(1)}$ is number of riders in a triangle with $(k+1)^2 + k$ rows, that is $$N_k^{(1)} = \frac{(k+1)(k+2)(k^2+3k+1)}{2}.$$

We can continue to define more configurations, e.g., let's say all number of riders that have two formations between a triangle and a rhombus where one formation is a triangle and the other has $\ell$ more rows, that is, $N^{(\ell)}_k.$ For the case of $\ell = 2,$ we would have $$\sum_{i=1}^k (n+i) = kn+\frac{k(k+1)}{2} = (k+2)n - \frac{(k+2)(k+3)}{2} = \sum_{i=1}^{k+2} (n-i),$$ which would imply that $$2n = \frac{k(k+1)}{2} + \frac{(k+2)(k+3)}{2} = k^2 + 3k + 3 = (k+1) (k+2) + 1;$$ however, since $(k+1)(k+2)$ is even, $(k+1) (k+2) + 1$ is always odd for all k, so there can be no solutions and there are no $k$ for which $N^{(2)}_k$ is defined. Luckily, all is not lost since as soon as we reach $\ell = 3,$ things start getting somewhat better. For $\ell = 3$, we have $$\sum_{i=1}^k (n+i) = kn+\frac{k(k+1)}{2} = (k+3)n - \frac{(k+3)(k+4)}{2} = \sum_{i=1}^{k+3} (n-i),$$ which would imply that $$3n = \frac{k(k+1)}{2} + \frac{(k+3)(k+4)}{2} = k^2 + 4k + 6 = (k+3)(k+1) + 3,$$ that is, $$n = \frac{(k+1)(k+3)}{3} + 1, \,\,\,\text{for $k \equiv 0, 2 \!\! \mod 3.$}$$ So since the total number of riders is the same as a triangle of $n+k$ rows, we have $$N^{(3)}_k = \frac{(k+1)(k+6)(k^2+7k+9)}{18},$$ whenever $k \equiv 0, 2 \mod \!\! 3.$ Similarly, we can find $$N_k^{(4)} = \frac{(k+2)(k+7)(k^2+9k+10)}{32},$$ whenever $k \equiv 1,2 \mod \!\! 4$ and $k \gt 2$ and $$N_k^{(5)} = \frac{(k^2+11k+15)(k^2+11k+20)}{100},$$ whenever $k \equiv 0, 4 \mod\!\!5$ and $k \gt 3.$

Though it is certainly possible that there might be others, I am somewhat confident that the next smallest number of riders with two or more formations is $N_2^{(3)} = 36.$ I am less confident, but will put it out there regardless, that $1275$ is the smallest number of riders that has three different formations, since we have both $N_9^{(3)} = N_{10}^{(4)} = 1275.$ In particular, the three formations for $1275$ riders are (a) a triangle of $50$ rows; (b) a triangle with $40$ rows, followed by $14$ rows of descending length; or (c) a triangle of $41$ rows, followed by $13$ rows of descending length.

For completeness, my working version of the sequence for number of riders that can form multiple triambuses or rhombangles or whatever we want to call them is: $$15, 36, 60, 66, 78, 95, 190, 210, 253, 325, 390, 406, 435, 518, 861, 903, 946, 1275, 1351, 1540, 1661, 2346, 2556, 2775, 3081, 3452, 3486, 4005, 4064, ....$$ However, more accurately, we can just throw on the working conditions, that it is the sequence of all numbers of riders that can form multiple triambuses where the overall number of rows in the different triambus formations differs by less than the index where I gave up, er, I mean less than $6$.

Sunday, September 10, 2023

Bobbin' and weavin'

A weaving loom set comes with a square with equally spaced hooks along each of its sides, as well as elastic bands that can be attached to the hooks.

Suppose a particular weaving loom has $N$ hooks on each side, evenly spaced from one corner to another (i.e., there are two hooks on the two corners and $N−2$ hooks between them). Let’s label the hooks along one side $A_1$ through $A_N$, the hooks on the next clockwise side $B_1$ through $B_N$ (with $A_N$ and $B_1$ denoting the same hook), the hooks on the third clockwise side $C_1$ through $C_N$, and the hooks on the final side $D_1$ through $D_N$.

Next, let’s use a whole bunch of elastic bands to connect hooks $A_1$ and $B_1$, $A_2$ and $B_2$, $A_3$ and $B_3$, and so on, up to $A_N$ and $B_N$. When $N = 100$, here’s what the loom looks like:

As $N$ increases, what is the shape of the curve formed by the edges of the bands?

Let's set up the framework, by assuming that the weaving loom, no matter the value of $N$, is the unit square $[0,1] \times [0,1].$ So that for instance $A_i = (0, \frac{N-i}{N-1})$ and $B_i = (\frac{i-1}{N-1}, 0),$ for $i = 1, \dots, N.$ The band connecting $A_i$ to $B_i$ can be represented by the line $$y = \frac{N-i}{N-1} \left(1 - \frac{N-1}{i-1} x\right) = \frac{N-i}{N-1} - \frac{N-i}{i-1} x.$$ Since we are primarily worried about the aggregate curve that is traced out by all of these lines, we really want to have $$f_N(x) = \max_{i = 2, \dots, N} \left\{ \frac{N-i}{N-1} - \frac{N-i}{i-1}x \right\}$$ which will eventually form a continuously differentiable function $f(x) = \lim_{N\to \infty} f_N(x).$

The interval on why the line from $A_i$ to $B_i$ will be maximal is $\left[ \frac{(i-1)(i-2)}{(N-1)^2}, \frac{i(i-1)}{(N-1)^2} \right]$ and the midpoint of this interval is $x_i = \left(\frac{i-1}{N-1}\right)^2.$ If we can find some convex $f$ such that $f_N(x_i) = f(x_i)$ for each $i = 2, \dots, N$ and $$\frac{d}{dx} f(x_i) = -\frac{N-i}{i-1},$$ for each $i = 2, \dots, N,$ then $f(x) = \lim_{N \to \infty} f_N(x)$ for all $x \in [0,1],$ since convex functions are the pointwise supremum of all affine minorants, up to and including their subdifferentials. So in particular, we see that $$-\frac{N-i}{i-1} = -\frac{N-1 - (i-1)}{i-1} = 1 - \frac{1}{\sqrt{x_i}},$$ for each $i = 2, \dots, N.$ Therefore, our best guess would be $$f(x) = f(0) + \int_0^x (1 - \frac{1}{\sqrt{t}}) dt = f(0) + x - 2\sqrt{x}.$$ Since the first band from $A_1$ to $B_1$ is along the $y$-axis, we should define $f(0) = 1,$ so that the weaver's loom always traces out a lower approximation of the convex function $$f(x) = 1 -2\sqrt{x} + x = (\sqrt{x} - 1)^2.$$ In particular, we can verify that $$f_N(x_i) = \frac{N-i}{N-1} - \frac{N-i}{i-1} x_i = \left( \frac{N-i}{i-1} \right)^2 = \left( \frac{i-1}{N-1} - 1\right)^2 = f(x_i),$$ and since $\frac{d}{dx}f(x_i) = -\frac{N-i}{i-1}$ for each $i = 2, \dots, N,$ by design, so we have confirmed that $f(x) \geq f_N(x)$ for all $N$ and $x \in [0,1]$ and the $f_N(x) \uparrow f(x)$ for all $x \in [0,1].$

Let's now go further and quadruple the number of bands placed on the weaving loom. In addition to the band connecting each $A_i$ and $B_i,$ you also place bands connecting $B_1$ and $C_1$, $C_1$ and $D_1$, and $D_1$ and $A_1$. You do this for all the sets of hooks from $1$ through $N,$ so that a total of $4N$ bands have been placed. When $N =100$, here is what the loom looks like:

As N increases, what fraction of the loom’s area lies between the four sets of bands? In other words, what fraction of the square above does the central white region make up?

We can skip to the end with our limiting curve of $f(x) = (\sqrt{x}-1)^2$ from the first portion of the problem, and then by symmetry take the area below the line $y = \frac{1}{2}$ and above $f(x)$ so long as $0 \leq x \leq \frac{1}{2}.$ This should give us one fourth of the answer. In particular, we see that the curve $y=f(x)$ intersects the line $y = \frac{1}{2}$ at $x = \left( 1 \pm \frac{\sqrt{2}}{2} \right)^2 = \frac{3}{2} \pm \sqrt{2}$ where only the negative sign gives a feasible answer less than $x = \frac{1}{2}$. Since we've defined the entire loom to have unit area, the fraction of loom made up by the white area as $N \to \infty$ is given by $$A = 4 \int_{\frac{3}{2}-\sqrt{2}}^\frac{1}{2} \left( \frac{1}{2} - (\sqrt{x} - 1)^2 \right) \,dx = \left[ \frac{16}{3}x^{3/2} -2x^2 -2x \right]_{\frac{3}{2} - \sqrt{2}}^\frac{1}{2} = \frac{8\sqrt{2}-10}{3} = 0.43790...$$