# Look-and-say
## Part 1
Understand how the "Look-and-say" sequence works.
Wikipedia links: [en](https://en.m.wikipedia.org/wiki/Look-and-say_sequence), [עב](https://he.m.wikipedia.org/wiki/%D7%A1%D7%93%D7%A8%D7%AA_%D7%A7%D7%95%D7%A0%D7%95%D7%95%D7%99%D7%99)
## Part 2
Implement the function:
```python
def look_and_say(df):
"""
Parameters:
df: Spark Dataframe with columns "id" and "num".
Returns:
Spark Dataframe with the same schema, but is the next iteration of the Look-and-say sequence.
The "id" colun is the column by which the order of the rows is determined.
"""
```
For instance, if `df.toPandas()` looks like this:
| id | num |
| --- | --- |
| 0 | 5 |
| 1 | 3 |
| 2 | 3 |
Then, `look_and_say(df).toPandas()` should look like that:
| id | num |
| --- | --- |
| 0 | 1 |
| 1 | 5 |
| 2 | 2 |
| 3 | 3 |
1. **Check your results with a pen and a paper, or compere to the Wikipedia page**
2. **Note (1): numbers with more then 1 diget shouldn't be separated to their digets, they should be considerd as one whole.**
3. Hint: read about `Window` operations in Spark.
## Part 3
1. Find how many ones there are in the 100'th iteration of the sequence, assuming the 0'th iteration is just "1".
2. Find the 10'th to last number in the 1000'th iteration. (can you improve your algorithm in this case?)
3. Ignore **Note (1)**, numbers like "10" should be treated as "1,0". How many iterations does it takes for this to influence the calculation? What is the length of the sequence at the point?