The cardinality of excluding '*a*b*' from S^n should be (m-1)^(n-1)*(m+n-1), where m=|S|. For m=5 this becomes 4^(n-1)*(n+4), and your table fits this formula. As far as generating and testing, an 'ideal' solution would be to 'start from the ground up', as in excluding length 2 wc, and then length 3, etc, until all wc's have been excluded. The 'ideal' solution would intrinsically exclude wc's and not test against a background generation of all of S^n. Does that make sense?
-- http://mail.python.org/mailman/listinfo/python-list