>>9194
Thinking more about this.
We know that 2 * d * (n - 1) % 8 = 0 or 4 depending on d. It is 0 if d is divisible by 8, 4 otherwise.
2d % 8 = 0 =2d(n-1) % 8 = 0
2d % 8 = 4 =2d(n-1) % 8 = 4
We know (n-1)(n-1) - 1 is divisible by 8. Leaving us with f and 2n.
If d is divisible by 8, we have f and 2n left. If f % 8 != 0, then the remainder of that has to complement 2n. In other words, we know something about the shape of 2n.
2n = 8 * k + r, where r is 8 - ((f - 2) % 8).
That also means that when we're filling out our triangles, the remainder of 2n (or f) can (/ must / have to?) be used to fill out a whole triangle containing the parts 2n missed.
We should be able to deduce some info about 2n.
(f - 2)%8 = 0, 2d % 8 = 0 =2n%8 = 0. Either that means n = 4x something or n = 8x something.
(f - 2)%8 = 0, 2d % 8 = k (k!=0) =2n%8 = 8-k. => 2n = 8 * o + (8 - k)
(f - 2)%8 = k (k!=0), 2d % 8 = 0 =2n % 8 = (8 - k) => 2n = 8 * o + (8 - k)
(f - 2)%8 = k (k!=0), 2d % 8 = l (l!=0)
(k + l) % 8 = 0 =2n % 8 = 0
(k + l) % 8 = m =2n % 8 = 8 - m => 2n = 8 * w + (8 - m)
I think that covers all the cases?
We can also then express our equation:
(n - 1)(n - 1) - 1 + 2n + 2d(n-1) + f - 2
as
8(k + m + j + n) + remainders (where k, m, j, n are ((n-1)(n-1) - 1)/8, 2n/8, 2d(n-1)/8 and (f-2)/8)
The sum of the remainders has to be equal to 8, otherwise we couldn't have a complete set of 8 triangles.