How to resolve the algorithm Thue-Morse step by step in the PL/M programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Thue-Morse step by step in the PL/M programming language
Table of Contents
Problem Statement
Create a Thue-Morse sequence.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Thue-Morse step by step in the PL/M programming language
Source code in the pl/m programming language
100H:
BDOS: PROCEDURE (F,A); DECLARE F BYTE, A ADDRESS; GO TO 5; END BDOS;
EXIT: PROCEDURE; GO TO 0; END EXIT;
PUT$CHAR: PROCEDURE (C); DECLARE C BYTE; CALL BDOS(2,C); END PUT$CHAR;
/* FIND THE NTH ELEMENT OF THE THUE-MORSE SEQUENCE */
THUE: PROCEDURE (N) BYTE;
DECLARE N ADDRESS;
N = N XOR SHR(N,8);
N = N XOR SHR(N,4);
N = N XOR SHR(N,2);
N = N XOR SHR(N,1);
RETURN N AND 1;
END THUE;
/* PRINT THE FIRST 64 ELEMENTS */
DECLARE I BYTE;
DO I=0 TO 63;
CALL PUT$CHAR('0' + THUE(I));
END;
CALL EXIT;
EOF
You may also check:How to resolve the algorithm Calculating the value of e step by step in the Burlesque programming language
You may also check:How to resolve the algorithm Rename a file step by step in the BBC BASIC programming language
You may also check:How to resolve the algorithm Circles of given radius through two points step by step in the Python programming language
You may also check:How to resolve the algorithm Equal prime and composite sums step by step in the Perl programming language
You may also check:How to resolve the algorithm 100 prisoners step by step in the QB64 programming language