How to resolve the algorithm Look-and-say sequence step by step in the Quackery programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Look-and-say sequence step by step in the Quackery programming language
Table of Contents
Problem Statement
The Look and say sequence is a recursively defined sequence of numbers studied most notably by John Conway.
The look-and-say sequence is also known as the Morris Number Sequence, after cryptographer Robert Morris, and the puzzle What is the next number in the sequence 1, 11, 21, 1211, 111221? is sometimes referred to as the Cuckoo's Egg, from a description of Morris in Clifford Stoll's book The Cuckoo's Egg.
Sequence Definition
An example:
Write a program to generate successive members of the look-and-say sequence.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Look-and-say sequence step by step in the Quackery programming language
Source code in the quackery programming language
[ stack ] is instances
[ 1 instances put
$ "" swap
behead swap space join
witheach
[ 2dup != iff
[ rot instances share
number$ join
rot join swap
1 instances replace ]
else
[ drop
1 instances tally ] ]
drop instances release ] is lookandsay ( $ --> $ )
$ "1"
15 times
[ dup echo$ cr
lookandsay ]
echo$ cr
You may also check:How to resolve the algorithm Find the missing permutation step by step in the BBC BASIC programming language
You may also check:How to resolve the algorithm Pythagorean quadruples step by step in the Perl programming language
You may also check:How to resolve the algorithm Shoelace formula for polygonal area step by step in the FreeBASIC programming language
You may also check:How to resolve the algorithm Interactive programming (repl) step by step in the M4 programming language
You may also check:How to resolve the algorithm Apply a digital filter (direct form II transposed) step by step in the D programming language