> For the complete documentation index, see [llms.txt](https://trizen.gitbook.io/sidef-lang/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trizen.gitbook.io/sidef-lang/programming_tasks/l/look-and-say_sequence.md).

# Look-and-say sequence

```ruby
func lookandsay(str) {
    str.gsub(/((.)\2*)/, {|a,b| a.len.to_s + b })
}
 
var num = "1"
{
  say num;
  num = lookandsay(num)
} * 10
```

#### Output:

```
1
11
21
1211
111221
312211
13112221
1113213211
31131211131221
13211311123113112211
```
