Thanks for the reply. I realise I may have come across a tad confusing, I get caught up in things and lose my wording. Here's what I meant (and shall edit into the OP):
The important parts are bold, the rest is my usual senseless ranting...
Okay, I'm working on trying to build a very highly-optimized "word" generator. As we know, the total number of words is (charset lenght)^(word length). The biggest problem I've run into is the fact that removing repititions will require on-the-spot comparison or post-processing which both slow down the process.
So I want to figure out some form of mathematical approach.
The approach: We need to know two ranges. The first is the total number of increments (by 1) for which a pattern of more 3 (or a given number) of consecutive character repetitions will occur. Secondly, we need to know for how many imcrements will occur before the next repetition of 3 (or that given number). For example.
charset = ("0", "1") and word-length = 3. Total words:
000, 001, 010, 011, 100, 101, 110, 111
Not the best example but still. A 3-match occurs at 1 and again at 8. Now usually a program would compare word[0], word[1] and word[2] for a match of 3 each loop iteration. That's a serious bottleneck (and post-processing the list is no better). You could use multi-threading and have a worker-thread run through the list while it is being created, but we are still losing precious computational power generating those unwanted entries in the first place.
So what if we knew that it took exactly n iterations before we reached the first set with no 3-match patterns? What if we knew just how many until the next barrage of them? We could be talking serious word-generation power! Alas, I searched but could not find. My own thoughts were, "Well we have to work backwards, from the right side of the word since the left changes per iteration... hmm, if we just-- **BRAIN BSOD: Your brain encountered an error and has to restart. We apologize for the inconvenience. Please let us know by sending the crash report after restarting. We respect your privacy**" and that was me done.
I figured out one thing just now: we need to calculate the width each char adds to a pattern. In the example above it was the full length of the word-total, but, if my calculations are correct, it's (char position in set)^(word length). I haven't confirmed this 100% but will edit the OP with any findings.
You're a bad man!