Given two digit-strings $A$ and $B$, let $AB$ be their concatenation. So for example, if $A = ``102"$ and $B = ``101"$, $AB = ``102101"$.
We then say $AB \geq BA$ since $102101 \geq 101102$.
Now given digit strings $A$, $B$, and $C$, is it true that $$AB \geq BA \land BC \geq CB \Rightarrow AC \geq CA$$?
Context: This page gives 5 "simple" programming exercises. One of them is
Given a list of non negative integers, arranges them such that they form the largest possible number. For example, given [50, 2, 1, 9], the largest formed number is 95021.
My solution (and his solution) was to order the strings using the above comparison. This appears to work, but I'd like to prove it. I was able to come close to a proof, but it relies on the above comparison being a total preorder.
I've tried to prove the above transitivity relation in various ways, but have failed. A computer simulation of the first 100,000 numbers seems to imply it's true, though.
Let's denote the length (number of digits) in $A$ by $LA$ (and so on).
The first inequality you have is:
$A\times 10^{LB} +B \geq B\times 10^{LA} +A$
which can be rephrased as
$A\times(10^{LB}-1) \geq B\times(10^{LA}-1)$
or as
$A \geq B\times\frac{10^{LA}-1}{10^{LB}-1}$
Similarly, the second inequality can be rephrased as
$B \geq C\times\frac{10^{LB}-1}{10^{LC}-1}$
and the one you want to prove as
$A \geq C\times\frac{10^{LA}-1}{10^{LC}-1}$,
which now follows directly from the assumptions:
$A \geq B\times\frac{10^{LA}-1}{10^{LB}-1} \geq C\times\frac{10^{LB}-1}{10^{LC}-1}\times\frac{10^{LA}-1}{10^{LB}-1}=C\times\frac{10^{LA}-1}{10^{LC}-1}$.
(I implicitly assumed that none of these strings is of zero length)