The 9 Billion Names of God is a short story by Arthur C. Clarke. It's about a group of Tibetan monks whose order is devoted to writing down all the possible names of God, written in their own alphabet. Essentially, they are devoted to writing every possible permutation of their alphabet, restricted by a few rules. In the story, the monastery hires some engineers to write a program to do all the work for them. Your goal is to write that program.
The monk's alphabet uses 13 characters (according to my estimations). You may use
ABCDEFGHIJKLMor some other set of 13 characters.
The minimum length of a possible name is 1 character. The maximum length is 9 characters.
No character may repeat more than 3 times in succession.
AAABAis a valid name, but
Your program should print out (to a file) every possible name in sequence from
MMMLMMMLM, separated by any character not in the alphabet (newlines, semi-colons, whatever).
This is code-golf, and you can use any language. The shortest solution by June 1st 2014 wins.
Edit: The names should start with
A and end with
MMMLMMMLM, progressing through all the billions of names sequentially. But the particular sequence is up to you. You can print out all the 1-letter names first, then all the 2-letter names, etc. Or you can print all the names starting with
A, then all the ones starting with
B, or some other pattern. But a human should be able to read through the file and confirm they are all there and in whatever logical order you choose, assuming they have the time.