The Look and say sequence is a recursively defined sequence of numbers studied most notably by John Conway. Sequence Definition. Take a decimal number. Look at the number, visually grouping consecutive runs of the same digit.
The look and say sequence is a basic form of run length encoding. The sequence starts with the number 1 and each additional number encodes the number of digits
In any case, despite the inherent slowness of a double-interpreted language like GolfScript, the code runs quite fast and scales well: computing the length of the 10,000th string in the look-and-say sequence takes about 1.5 minutes on my computer.
Python Code For Generating Look and Say Sequence. Problems.
Find the n’th term in Look-and-say (Or Count and Say) Sequence.
Advent of Code. [About]. [Stats].
I can see two issues with your code: The result is expanded by k and a[i] although the counter k does not count chars a[i] but chars last. Replace a[i] by last here (you may not want to add anything in the first round).
The Challenge The shortest code by character count that will output the Morris Number Sequence. The Morris Number Sequence, also known as the Look-and-say sequence is a sequence of numbers that starts as follows: 1, 11, 21, 1211, 111221, 312211
In mathematics, the look-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 111221, 312211, 13112221, 1113213211, ... (sequence A005150 in OEIS). To generate a member of the sequence from the previous member, read off the digits of the previous member...
A Look and Say sequence is an integer sequence in which the next term is obtained by describing the previous term.