>The final steps involve finding a base using (f-1)/8 for each of the eight triangles (some a bit bigger than others by a unit in length) which is larger than (n-1)/8 BUT smaller than (x+n)/8.
Pics attached are an idea of how this could look for the c6701 and c27707 examples.
Starting with the (n-1)+(f-1) portion in the middle, a new red square outline has been added (f-1)/8 units from the center.
For the c27707, the light green squares around that red outline represent the u1=(f-1)/8 + 1 value of 23. And the light green squares represent the u2=(f-1)/8 value of 22.
The c6107 example computes to u1=17 and u2=16.
Attached are also rough calculations showing successful matches in 7 steps.