hp
toc

Generating the Prouhet-Thue-Morse sequence in brainfuck

2019-12-28, post № 223

brainfuck, mathematics, programming, #recursive, #Thue-Morse sequence

[-]<<<[-]<<<[-]<<<[-]<<<[-]<<<[-]>>>>>>>>>>>>>>>>>[-]++++++++++++++++++++++++++++++++++++++++++++++++.[-]<[-]>>[-]<[-<+>>+<]>[-<+>]<<<<<[-]>>>[<<<+>>>-]<<<<<<<<<<<<[-]>>>>>>>>>[<<<<<<<<<+>>>>>>>>>-]<<<<<<<[<<<<<<<<<<<[-]>>>>>>>>>[<<<<<<<<<+>>>>>>>>>-]<<<<<<<]<[-]<[>+<-]>>+<<<<<<<<<[-][-]>>>>>>>>>[>>>>>>>>>]>>[-]+[>[-]+[<<[-]<<<<<<<<<<[<<<<<<<<<]>>>>>>>>>[-]>>>>>>>[-]<<<<<<<<[>>>>>>>>+<<<<<<<<-]>>>>>>>>>>[>>>>>>>[-]<<<<<<<<<[>>>>>>>>>+<<<<<<<<<-]>>>>>>>>>>>]<<[>>>+<<<-]>>>>>>[-]<<<[->>>+<<<][-]>>>>[-]<[-<<<+>>>>+<]>[-<+>]<<<<<<<<<<[-]>>>>>>[<<<<<<+>>>>>>-]<<<<<<<<<<<<<<<[-]>>>>>>>>>[<<<<<<<<<+>>>>>>>>>-]<<<<<<<[<<<<<<<<<<<[-]>>>>>>>>>[<<<<<<<<<+>>>>>>>>>-]<<<<<<<]<[-]<[>+<-]>>+<<<<<<<<<[-][-]>>>>>>>>>[>>>>>>>>>]>>>>>>>>[-]+<[->[-]<]>[-<+>]<<<<[-]>>>>[-]<[-<<<+>>>>+<]>[-<+>]<<<<<<<<<<<<<[-]>>>>>>>>>[<<<<<<<<<+>>>>>>>>>-]<<<<<<<<<<<<<<<<<<[-]>>>>>>>>>[<<<<<<<<<+>>>>>>>>>-]<<<<<<<[<<<<<<<<<<<[-]>>>>>>>>>[<<<<<<<<<+>>>>>>>>>-]<<<<<<<]<[-]<[>+<-]>>+<<<<<<<<<[-][-]>>>>>>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