# Look-and-Say Sequence

An interesting nonmathematical sequence which yet has interesting mathematical properties is the Look-and-say sequence.
As every good sequence it starts with a 1. From there you get each next entry by looking at the previous and saying it. The next entry will thus be “one 1” or 11. From there “two 1” or 21, then “one 2; one 1” or 1211, “one 1; one 2; two 1” or 111221 and so on.

#### Generating the sequence The mathematical property although does not lie in the entry’s value, but rather in its length.

#### Calculating the length of each entry The interesting thing about the length is, that it approximately grows by λ each time. $\big( \lambda = 1.303577269034\dots \big)$
This constant λ can be calculated by getting the real root of a degree 71 polynomial (see Nathaniel Johnston’s post for further information) or be approximated by dividing entrys. $\big( \lambda = \frac{\text{entry}_{n+1}}{\text{entry}_{n}} \text{ for } n \rightarrow \infty \big)$

#### Approximating λ # Python 2.7.7 Code
# Jonathan Frech 25th of February, 2016
#         edited 26th of February, 2016
#         edited 28th of February, 2016
#         edited  4th of March   , 2016

# set the program's mode
MODE = ["sequence", "length", "lambda"]

# special case
if seq == "":
return "1"

# result
res = ""

# init
c = seq
a = 1
seq = seq[1:len(seq)]

# loop (look at the sequence and 'say' it)
for s in seq:
if s == c:
a += 1
else:
res += str(a) + c
c = s
a = 1

# return
return res + str(a) + c

# generate the sequence
if MODE == "sequence":
seq = ""
while True:
print seq

# generate the sequence and get each entry's length
elif MODE == "length":
seq = ""
while True:
seq = nseq