I recently had to create a bail predictor for work in order to save our underwriters time on finding out exactly what the bail amount is going to be for any given charge. I admit that I took the easy way out on the pattern recognition search algorithm by using exponents, but in the process I discovered something that may be useful in the future.
What I did was take an input (like "pattern"), look at its length, and then calculate the length of the input as well as all of the patterns within the input. The recursive math looks something like this.
Pattern(length of 7)
As you see, it gets exponentially larger, but there's no mathematical equation or operator that I know of that will give you the addition of all of these numbers (it's hierarchical).
I just took the easy way out and took the length of the pattern and raised it to the power of its own length. It works the same way, maybe even better... that's why I don't know why I'm writing this out to begin with but whatever.
The hierarchical recursive pattern above comes out to a strength 247 whereas just doing the exponent comes out to a much higher number.