# Grow in a slow-growing sequence [duplicate]

### Background

There is an interesting question on MathSE about some conjectures that are disproven by extremely large counter-examples. This delightful answer tells the story of a sequence of numbers called Gijswijt's sequence, which is now registered as A090822. The sequence is defined as follows

Let $$\a_1 = 1\$$ and for $$\n>1\$$, set $$\a_n\$$ as the largest integer $$\k\$$, such that the word $$\a_1 a_2 \cdots a_{n-1}\$$ is of the form $$\x y^k\$$ for words $$\x\$$ and $$\y\$$ (where $$\y\$$ has positive length), i.e., the maximal number of repeating blocks at the end of the sequence so far.

I hope it's OK here to copy the demonstration given by Yuriy S: At first it was thought that no number in this sequence exceeds 4, which appears for the first time in $$\n=220\$$. But later, it was proved that we will have a 5 after a very very long time, and the sequence is actually unbounded!

### Challenge

Given the input $$\n\$$ which is a positive integer, print the sequence $$\a_1 a_2\cdots a_n\$$. If you are more comfortable with separating the $$\a_i\$$s by an arbitrary separator, do as you wish.

Standard rules apply. Please let me know if any more clarifications (or maybe test cases) are needed.

• Should I delete my question? Sep 23, 2020 at 12:53
• I don’t think there’s any need to delete your question, you were just unlucky that it had already been asked before. I’d recommend using the Sandbox next time though Sep 23, 2020 at 12:59