# Look-And-Say Sequence

According to John Conway, this sequence was constructed and presented to him by one of his students. The construction is rather random, it involves reading the number left to right, and write down the number of consecutive numbers.

#### e.g. for the number “1211”, reading left to right, there are “one ‘1’, one ‘2’ and two ‘1’”, so the next  number is “111221”. Reading this number again, we get “three ‘1’, two ‘2’ and one ‘1’”. Hence the next number is 312211.

Here is a Mathematica code of how to construct and list such sequence:

 f[seed_] := Module[{a = seed}, s = Split[IntegerDigits[a]]; t = Map[Length, s]; u = Map[DeleteDuplicates, s] // Flatten; v = Riffle[t, u]; FromDigits[v] ]

n=50;

For[i = 1, i <= n, i++,
Subscript[a, 1] = 1;
Subscript[a, i + 1] = f[Subscript[a, i]];
]

table = Table[Subscript[a, i], {i, 1, n}]

One of the curious property of this sequence, is that, if we allow $L_n$ to denote the number of digits in the n-th Look-And-Say number, then the ratio $\frac{L_n+1}{L_{n}}$ tends to an number (Conway proved that this is an algebraic number, being a root of a polynomial): http://en.wikipedia.org/wiki/Look-and-say_sequence

 leng = IntegerLength[table] Ratios[leng] // N ListPlot[leng]

We see that the ratios tends towards the constant 1.303577269….

This piece code are so short, thanks for the many easy to use functions in Mathematica, such as IntegerDigits, FormDigits and Riffle.