The look-and-say sequence is a concealed and mysterious topic of mathematics. But don’t think of it as just a sequence. It’s more than a sequence. This sequence has a unique and mysterious characteristic that is really difficult to understand and solve. This sequence is also known as the Morris Number Sequence. Robert Morris was a famous cryptographer and he asked a puzzle: “What is the next number in the sequence 1, 11, 21, 1211, 111221?” Can any of you solve this? I think, not too easily. You can try your best to solve it.
\[1, 11, 21, 1211, 111221, \ldots\]
is known as the look-and-say sequence. Why this type of name for the sequence? It is the key point about this sequence. Just try to think of the sequence from a different view of your mind. You may get the answer.
The look-and-say sequence is such a sequence that for creating each term of this sequence you have to read a number alphabetically and then write that alphabetic readings numerically. You can take any number as a starting number, and then follow this rule to produce next numbers.
The rules are as follows:
- Take any number you like.
- Pronounce the number correctly. As for the number 1, It must be read as "one 1," where “one” represents the total digits of that number.
- Now write the "one 1" numerically. So we get the number 11.
- Next we can read 11 as "two 1." So the next number of this sequence is 21.
- Apply the same method for finding the next number of the sequence.
- The starting number may be any number you want.
- This sequence grows indefinitely.
- Only for same digits of number like 22, if you apply the above method , this will return the same result 22 instead of a sequence.
- Only the digits 1, 2, and 3 are the members of this sequence. There must not be any other number.
Every sequence eventually splits (“decays”) into a sequence of “atomic elements,” which are finite subsequences that never again interact with their neighbors. There are 92 elements containing the digits 1, 2, and 3 only, which John Conway named after the natural chemical elements. There are also two “transuranic” elements for each digit other than 1, 2, and 3. (From Wikipedia)
If we start from 1 as the first digit, the sequence will be as follows:\[\]
Python Code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
def lookandsay(number): result = "" repeat = number number = number[1:]+" " times = 1 for actual in number: if actual != repeat: result += str(times)+repeat times = 1 repeat = actual else: times += 1 return result num = "1" for i in range(10): print (num) num = lookandsay(num)