2
\$\begingroup\$

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:

copied from the original MathSE answer

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.

\$\endgroup\$
2
  • \$\begingroup\$ Should I delete my question? \$\endgroup\$ – polfosol ఠ_ఠ Sep 23 '20 at 12:53
  • 4
    \$\begingroup\$ 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 \$\endgroup\$ – caird coinheringaahing Sep 23 '20 at 12:59

Browse other questions tagged or ask your own question.