# On the first sequence without triple in arithmetic progression

In this Numberphile video (from 3:36 to 7:41), Neil Sloane explains an amazing sequence:

It is the lexicographically first among the sequences of positive integers without triple in arithmetic progression (i.e., such that for any two distinct points in the graph, there is no point in their middle, as for $$a_n=n^2$$ or $$b_n = 2^n$$). It is due to Jack W. Grahl (2013): A229037. $$1, 1, 2, 1, 1, 2, 2, 4, 4, 1, 1, 2, 1, 1, 2, 2, 4, 4, 2, 4, 4, 5, 5, 8, 5, 5, 9, 1, 1, 2, 1, 1, 2, 2, 4, 4, \dots$$ Its graph is surprising:  The following colored plot of 16 million terms is due to reddit user garnet420 (horizontal divisions are 1000000; vertical divisions are 25000). This sequence reveals many possible questions (like the existence of a convergent pattern, a fractal structure), the following one is due to Charles R. Greathouse (and deserves to be posted here):

Question: Does the term $$1$$ appear infinitely many times in this sequence?

Remark: the first numbers $$n$$ for which the $$n^{th}$$ term is $$1$$ are given by A236246.
$$1, 2, 4, 5, 10, 11, 13, 14, 28, 29, 31, 32, 37, 38, 40, 41, 82, 83, 85, 86, 92, 93, 96, 105, \dots$$ In addition, we observe that the succession $$1, 1, 2, 1, 1, 2, 2, 4, 4$$ appears several times, so we could also ask whether it appears infinitely many times.

Finally, we can create variations of the first sequence, replacing triple by $$r$$-tuple for a fixed $$r \ge 3$$, and ask the same questions.

Let us consider the variation suggested by Richard Stanley in comment where we only exclude weakly increasing arithmetic progressions. The first terms are the same up to the $$54^{th}$$ term.
For the former sequence, the $$20$$ next terms are $$9, 4, 4, 5, 5, 10, 5, 5, 10, 2, 10, 13, 11, 10, 8, 11, 13, 10, 12, 10, 10$$ whereas for the variation they are $$2, 4, 4, 5, 5, 10, 5, 5, 10, 10, 11, 13, 10, 11, 10, 11, 13, 10, 10, 12, 13$$ It is now available on OEIS at A309890. Listen it played with a marimba, it's incredibly pleasant!

Its graph is completely different, but also amazing:

Finally the numbers $$n$$ for which the $$n^{th}$$ term is $$1$$ are given by A003278 (see Richard's comment). A SageMath code computing the variation:

# %attach SAGE/ThreeFree.spyx

from sage.all import *

cpdef ThreeFree(int n):
cdef int i,j,k,s,Li,Lj
cdef list L,Lb
cdef set b
L=[1,1]
for k in range(2,n):
b=set()
for i in range(k):
if 2*((i+k)/2)==i+k:
j=(i+k)/2
Li,Lj=L[i],L[j]
s=2*Lj-Li
if s>0 and Li<=Lj: # this second assumption provides the variation
if 1 not in b:
L.append(1)
else:
Lb=list(b)
Lb.sort()
for t in Lb:
if t+1 not in b:
L.append(t+1)
break
return L


For having the graph, do points([(i+1,L[i]) for i in range(n)],size=1,alpha=0.04,dpi=1000)

• If we modify the definition so that we only exclude weakly increasing arithmetic progressions, i.e., $a(j),a(j+k),a(j+2k)$ are in arithmetic progression (with $k\geq 1$) and $a(j)\leq a(j+k)\leq a(j+2k)$, then it is easy to see that terms equal to 1 are indexed by oeis.org/A236246. This suggests looking some more at this modified sequence. Could it coincide with the original sequence? I haven't tried to check this experimentally. – Richard Stanley Aug 17 at 23:25
• @RichardStanley Let $a$ be the former sequence, let $b$ be the modified one, and assume that the terms indexed by $1$ are unchanged. Observe that $a(27) = 9$ and $a(59) = 5$, but there is no $i \ge 0$ and $k>0$ such that $a(i)=a(i+k)=1$ and $i+2k = 59+59-27 = 91$, so $b(91) = 1$, but $a(91)=2$, contradiction. – Sebastien Palcoux Aug 18 at 12:29
• Oops, I foolishly assumed that A236246 was actually oeis.org/A003278 without checking. It is clear that the indices for which $b(n)=1$ coincide with A003278. Perhaps it would be interesting to consider $b(n)$ for its own sake. – Richard Stanley Aug 19 at 14:36
• I wonder if for the question whether every natural occurs at all in this sequence, even though it seems intuitively clear, it is easier to prove that the answer is positive. – Wolfgang Aug 20 at 20:13
• A better visualization (see this question on ask.sagemath.org, especially the last comments) shows that the "empty" regions are not empty, but simply too sparse to get a visible representation on the rendered graph. – user2903730 Aug 25 at 15:59