I often have to generate the look and say sequence so I created this simple online utility that does it for me. It lets you calculate however many look and say series terms you need, starting from any initial state. It works in the browser and is powered by alien technology from the future.
Look And Say Sequence Generator Options
Look And Say Sequence Generator Examples (click to try!)
1 11 21 1211 111221 312211 13112221 1113213211 31131211131221 13211311123113112211 11131221133112132113212221 3113112221232112111312211312113211 1321132132111213122112311311222113111221131221 11131221131211131231121113112221121321132132211331222113112211 311311222113111231131112132112311321322112111312211312111322212311322113212221
abc 1a1b1c 111a111b111c 311a311b311c 13211a13211b13211c 111312211a111312211b111312211c
22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22
k → 1k → 111k → 311k → 13211k
 1 111 311 13211 111312211 31131122211 1321132132211
How Does This Look And Say Sequence Generator Work?
nextElement() function to calculate every next member. In the first iteration, it passes the
initial-state value (specified in options) to this function, gets the return value, and in all next iterations, it passes the return value from the previous call. This function uses only three variables –
result, and a single
for loop over the current element. The variable
symbol is the character it's currently looking at,
counter is how many times it has seen this symbol repeated, and
result is used for building the return value. In the loop, it compares the current
symbol with the next one. If they are the same, then it increments the
counter value; otherwise, it appends
counter + symbol to the
result. When this loop finishes, it returns the
result and it gets appended to the
lookAndSaySeq array. This algorithm continues as long as
lookAndSaySeq.length is less than
count (sequence length; specified in options). When the algorithm terminates, this utility displays the
lookAndSaySeq array. If you entered a custom term
separator in the options, then it calls the
lookAndSaySeq.join(separator) function that converts the array with look and say values to a string, separating all the values with the specified character.
Created by Browserling
This look and say sequence generator was created by me and my team at Browserling. Behind the scenes, it's actually powered by Browserling's programmer tools that are used by millions of people every month. Browserling itself is an online cross-browser testing service powered by alien technology. Check it out!
Secret message: If you love my tools, then I love you, too! Use coupon code COMLING to get a discount at my company Browserling.