Attached in this post is a formula I've been working on. I presented it to AI, made a few refinements, but I'm well aware this is far from perfect math language (I'm still in school, never taken courses that might help with this like a proof class, so this is more a work-in-progress). Basically, don't expect it to be written perfectly, understanding it is more important to provide any help with it. I did include something non-standard where I defined a finite overline to compare to its infinite overline counterpart in this. I've also attached examples to go with it, each going into potential difficulties you might have following my formula, but should cover all the basics of how it works. I understand there are a lot of variables so it might seem overwhelming at first, but it all comes together pretty neatly once understood. You can even skip a lot to the end when you know what you're doing, the formula just covers the concept more in its entirety.
Feel free to test it (if you have any doubts about how it works, and it is possible I made a mistake on the examples but tried not to), I've gone through it pretty thoroughly, but it's possible I missed something. What I'm really looking for is more input and suggestions, maybe even getting the math language to use with this down to be exact. So any help would be appreciated, and of course, willing to answer any questions on it.
*edit: I did not realize the pictures would be shown in the way they did, so I simply left 1 example and the formula. So now it should be easier to see without the confusion despite how it might not show all the cases that might come up.
Attachments: