OFFSET
1,3
COMMENTS
It is easy to see that a number can occur no more than twice: 1) If a number occurs twice, one term with that value must be at an odd n and the other at an even n. This is because otherwise you could always find a progression of the form ABA. 2) Once two terms of the same value are in the sequence on an even and odd n, no third term with that value can be added without creating a progression of form ABA.
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000
EXAMPLE
a(4)=2 because if a(4) were 1 the 2-4th terms would be the ABA-form progression 1,2,1. 2 here is the smallest number which forms neither an arithmetic nor ABA progression.
PROG
(Python)
from itertools import count, islice
def agen(): # generator of terms
alst, mink, aba = [0], [1, 1], [set(), set()] # even, odd appearances
for n in count(1):
k = mink[n&1]
ff = set(2*alst[n-i] - alst[n-2*i] for i in range(1, (n+1)//2))
while k in ff or k in aba[n&1]: k += 1
alst.append(k); aba[n&1].add(k); yield k
while mink[n&1] in aba[n&1]: mink[n&1] += 1
print(list(islice(agen(), 70))) # Michael S. Branicky, Dec 12 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Neal Gersh Tolunsky, Dec 11 2022
EXTENSIONS
More terms from Michael S. Branicky, Dec 12 2022
STATUS
approved