Basic coding

SmallBASIC implementations: 
The basic idea behind coding is systematic replacement of one symbol or set with another.

Here is example of replacing a 0 with 010 and a 1 with 110, this leads to an expanding set of symbols.

For
"an a" type coding* a very interesting thing happens in the expansions.


t$ = "0"
for
r = 1 to 5
s$ = t$ : t$ = ""
for i = 1 to len(s$)
c$ = mid(s$, i, 1)
if c$ = "0" then t$ = t$ + "010" else t$ = t$ + "110"
next
print t$ : ?
next


Try different replacements for 0 and 1, say 0 = "01" and 1 = "10" or "11"

Try for different substitutions of different amounts of 0's and 1's.
0 = 1011 , 1 = 0100...

See a pattern?

* note: from "Wonders of Numbers: Adventures in Mathematics, Mind, and Meaning" by Clifford Pickover, Oxford 2001. Chapter 69 p 167 "An A?"