REM >thuemorse tm$ = "0" PRINT tm$ FOR i% = 1 TO 8 tm$ = FN_thue_morse(tm$) PRINT tm$ NEXT END : DEF FN_thue_morse(previous$) LOCAL i%, tm$ tm$ = "" FOR i% = 1 TO LEN previous$ IF MID$(previous$, i%, 1) = "1" THEN tm$ += "0" ELSE tm$ += "1" NEXT = previous$ + tm$