OFFSET
1,1
COMMENTS
For n >= 1, a(n+1) is the largest integer k for which there exists an arithmetic progression n-(k-1)*d, n-(k-2)*d, ..., n of length k ending in n such that a(n-(k-1)*d) = a(n-(k-2)*d) = ... = a(n). Note that it is obvious from the definition that a(n+1) >= 1, since a(n) alone is already an arithmetic progression of length 1.
Theorem: The sequence contains all positive integers.
Proof: Suppose not. Then there exists an n such that a(n)+1 is not in the sequence. By definition, if some integer m is contained in the sequence, all integers less than m must be as well. Hence a(n) is in fact the largest integer in the sequence. But then {a(n)} gives a coloring of all positive integers with only a(n) different colors, contradicting Van der Waerden's theorem.
If we set a(1) for example as 0,1,4,6,9,10 and apply the same rule for a(n) with n > 1, the corresponding sequence appears to fall into a regular pattern after around 50 terms. For other starting values such as 2,3,5,7,8, the corresponding sequence appears to grow slowly, possibly with some high values in the beginning. For this sequence (a(1)=2), the largest value in the first 10^5 terms appears to be 14.
LINKS
Eric Weisstein's World of Mathematics, Van der Waerden's theorem
EXAMPLE
a(12)=3 since 1,6,11 is the longest arithmetic progression ending in 11 for which a(1)=a(6)=a(11)=2.
a(14)=4 since 1,5,9,13 is the longest arithmetic progression ending in 13 for which a(1)=a(5)=a(9)=a(13)=2.
PROG
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Hugo Sauerbier Couvée, Feb 20 2021
STATUS
approved