Re: Generating all sequences of 1s and 0s of length 30
First issue: you are searching through a space of 2^30 or 1,073,741,824 strings.
Second issue: your "invalid" strings consist of
2^1 3 digit strings
2^2 6 digit strings
2^3 9 digit strings
2^4 12 digit strings
2^5 15 digit strings
...
2^10 30 digit strings
This means you have 2^11-2 potential substrings to check for each of your strings. Of course, some of the longer strings are invalid because of the shorter strings (00 00 00 contains 000, etc).
The two options I can see are:
1) build a minimal list of invalid substrings, and for each candidate, check for the presence of all the invalid substrings. This may be prohibitively large.
2) for each string, loop through it grabbing 1, then 2, then 3, etc characters, checking to see if it is the basis of an invalid string.
|