How to resolve the algorithm Thue-Morse step by step in the jq programming language

Published on 12 May 2024 09:40 PM
#Jq

How to resolve the algorithm Thue-Morse step by step in the jq 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 jq programming language

Source code in the jq programming language

def thueMorse:
  0,
  ({sb0: "0", sb1: "1", n:1 }
   | while( true;
      {n: (.sb0|length),
       sb0: (.sb0 + .sb1),
       sb1: (.sb1 + .sb0)} )
   | .sb0[.n:]
   | explode[]
   | . - 48);


[limit(100;thueMorse)] | join("")


  

You may also check:How to resolve the algorithm Sorting algorithms/Shell sort step by step in the Elixir programming language
You may also check:How to resolve the algorithm Abundant odd numbers step by step in the Frink programming language
You may also check:How to resolve the algorithm Curzon numbers step by step in the Quackery programming language
You may also check:How to resolve the algorithm Thue-Morse step by step in the Quackery programming language
You may also check:How to resolve the algorithm Hello world/Text step by step in the K programming language