From the printer’s bench
Two rulers for the printer
The letters were in the right order. It was the mileages he’d left off.
Fast train starts at left. H: head-on. C: catch-up. No marks at the ends.
Railway 3:1
- H
- C
- H
Railway 4:1
- H
- C
- H
The strips agree.
The printer’s rule
Unfold each railway into mirrored copies of length one. For reduced speeds a > b, equality after folding means the unfolded positions either agree or are negatives modulo two. Since the second train starts at one, these give the odd multiples of 1/(a+b) for head-on meetings and of 1/(a−b) for catch-up meetings, apart from ties at the termini.
For either denominator q = a±b, multiply by a and fold the numerator modulo 2q. Coprimality makes the resulting interior posts exactly the fractions k/q with 0 < k < q and k of the same parity as a. There are ⌊q/2⌋ such posts in each family. A shared interior post could only be 1/2, since the two denominators have gcd at most two. When both are even, their halves have different parity, so only one family can use 1/2.
Matching counts leave at most an odd:odd ratio a:b and its neighbor (a+1):b. With n=(a−b)/2, the counts of H before the jth C are j+⌊b(j−½)/n⌋ and j+⌊bj/(n+½)⌋. For b=1 both floors vanish. Otherwise choose 1 ≤ k < b with kn ≡ (b+1)/2 modulo b. At j=⌊kn/b⌋+1 the first floor is less than k and the second is at least k. Only the alternating strips coincide.