Sorting numbers: maximal number of comparisons for sorting n elements by binary insertion

Open in the 3-D viewerA001855 on the OEIS
| Terms | 100,000 (n = 1 … 100,000) |
|---|---|
| Decomposable (a > 2d) | 99,996 |
| Level class, k > L | 32,017 · 32.02 % |
| Weight class, k ≤ L | 67,979 · 67.98 % |
| Ties, k = L | 46 |
| On the level line L = 1 | 12,230 |
| Forced level, l ≤ d² | 3 |
| Range of a(n) | 0 … 1,568,929 |
| Range of the jump d | 1 … 17 |
| Largest weight k, level L | 1,568,657, 87,158 |
d = ceil(log2 n) exactly, constant on dyadic blocks. l/d^2 grows without bound so the level-forcing criterion never fires: 68 % weight. The gap sets a left wall - no weight column below k = d can exist.
The decomposition
Every term of a strictly increasing sequence is written a(n) = k(n)·L(n) + d(n): the jump d = a(n+1) − a(n), the weight k the least divisor of a − d greater than d, the level L = (a − d)/k. A term decomposes when a > 2d; it is in the level class when k > L and in the weight class when k ≤ L. See decompwlj.com and arXiv:0711.0865, or how it works, with worked examples and a live one.