>>5874
To clear this up slightly, the base of a triangle WITHIN the triangle.
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.
The choices reduce 'exponentially' and with less complexity than find the root of C, so the last steps do not push the overall complexity Big Oh above Big Oh for finding the root.
Using the previously supplied C# method before, you construct the first guess of (x+n)/8 which is too small but larger than (n-1)/8.
So, the biggest hint so far.
For odd (x+n) and odd (n-1) to start with.
(n-1)/8, (f-1)/8, (x+n)/8
You are lining these triangular bases up by picking (f-1)/8 that is between (n-1)/8 and (x+n)/8.
The properties of 2d and f limit the factors that will lock these values together. For two prime factors there is one way and for more than two prime factors there are more and more ways depending on the number of factors.
If you can find a way to visualise this like you have above, it will become clearer very quickly.