I wasn’t entirely happy with stepping C through all the available positions between A and D. It’s probably more efficient to see how many positions there are and just consider divisors of that number (where it’s possible for it to be divided it into n equal sized chunks).