Kevin-Lee/LookAndSaySequenceExample.java. Created Sep 8, 2012.
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.
Find the n’th term in Look-and-say (Or Count and Say) Sequence.
Look and say sequence is the sequence of numbers generated from the previous number by reading off the digits of which the number consists.
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...
Chris developed a regular expression implementation in Java that also uses recursion.
The Look-and-Say Sequence with Digits 1 and 2. Closely related to the ternary version of the sequence is the sequence obtained by reading the previous term in the sequence, but with the restriction that you can never use a number larger than 2 (see A110393).
Replace a[i] by last here (you may not want to add anything in the first round). After the loop you have to add the last value of the counter together with the last character again (this was not yet done), i.e. add another result = result+str(k)+last after the loop. In total it looks like.
That is: look-and-say is like Fibonacci, just with 92 instead of 2. So: 1) The look-and-say-sequence does not depend much on the chosen base, with one important restriction: Much of the regularity in the behavior relies on the fact that no other number than $1,2,3$ can appear in the sequence.