LookSay/JuliaZ | LookSay/Emets_E_S | ||||
---|---|---|---|---|---|
n | 1 | import itertools | n | 1 | from itertools import groupby |
2 | 2 | ||||
3 | def LookSay(): | 3 | def LookSay(): | ||
n | 4 | number = [1] | n | 4 | seq = [1] |
5 | while True: | 5 | while True: | ||
n | 6 | for i in number: | n | 6 | for i in seq: |
7 | yield i | 7 | yield i | ||
t | 8 | new_number = [] | t | 8 | tmp = [] |
9 | for (k, g) in itertools.groupby(number): | 9 | for (i, j) in groupby(seq): | ||
10 | new_number.append(len(list(g))) | 10 | tmp.append(len(list(j))) | ||
11 | new_number.append(k) | 11 | tmp.append(i) | ||
12 | number = new_number | 12 | seq = tmp |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|