IDEA:
Prendo il programma duplicatore (vedi fine sezione 2), aggiungo istruzioni per spostarsi a destra finta la duplicazione, cancellare un "1" da una seconda stringa di "1", tornare sulla prima stringa di 1, e ripetere la duplicazione fino a che ci sono "1" nella seconda stringa:
10111111111 110111111111 11011111111 1111011111111 111101111111 11111111011111111 1111111101111111 111111111111111101111111 11111111111111110111111 111111111111111111111111111111110111111 11111111111111111111111111111111011111 ... 1111 ... [ 512 "1" ] ...111111111111101 1111 ... [ 1024 "1" ] ...1111111111110Vediamo w che generi 11111111 (23 "1"):
Codifica 000 print 0 001 print 1 010 go left 011 go right 100 stop istruzioni 110..(n 1)..0 go to step n if 1 is scanned 101..(n 0)..1 go to step n if 0 is scanned Codifica programma: 1 + CodificaIstruzione1 + CodificaIstruzione2 + ... + 111 10000101101100010111101111100010111101001110100000000000000000000001011110111111 1111110010000010110111111111111111100101101111111111111111110011110101001111011 n.bit= 159 duplico prima stringa -------------------------- 000 1 print 0 010 2 go left 110110 3 go to step 2 if 1 is scanned 001 4 print 1 011 5 go right 110111110 6 go to step 5 if 1 is scanned 001 7 print 1 011 8 go right 11010 9 go to step 1 if 1 is scanned -------------------------- se c'è, cancello ultimo "1" di seconda stringa -------------------------- 011 10 go right 10100000000000000000000001 11 go to step 22 if 0 is scanned 011 12 go right 1101111111111110 13 go to step 12 if 1 is scanned 010 14 go left 000 15 print 0 -------------------------- torno su inizio prima stringa e rivado al passo 1 -------------------------- 010 16 go left 11011111111111111110 17 go to step 16 if 1 is scanned 010 18 go left 1101111111111111111110 19 go to step 18 if 1 is scanned 011 20 go right 11010 21 go to step 1 if 1 is scanned 100 22 stop input: 1011 output: 11111111Se all'input aggiungo 7 "1" ottengo un output di 210 "1":
input: 10111111111 output: 11111111 ... [ 1024 "1" ] ... 111