OFFSET
1,3
COMMENTS
In other words, a(n) is the length of the shortest subsequence ending at a(n-1) which has unique first differences among all first differences of subsequences of the sequence thus far.
LINKS
Neal Gersh Tolunsky, Table of n, a(n) for n = 1..10000
Neal Gersh Tolunsky, Ordinal Transform of 500000 terms
EXAMPLE
a(8)=2 because the length-2 subsequence a(6..7) = 4,3 has the shortest unique first differences (-1) of any other subsequence in the sequence thus far.
a(9)=3 because the length-3 subsequence a(6..8) = 4,3,2 likewise has the shortest unique first differences (-1,-1). No shorter subsequence ending in a(8) with unique first differences exists in the sequence thus far. We cannot have, for example, a(7..8) = 3,2 since we saw a subsequence with the same first differences in the previous example, where a(6..7) = 4,3 has first difference (-1).
PROG
(Python)
from itertools import count, islice
def fd(t): return tuple(t[i]-t[i-1] for i in range(1, len(t)))
def agen(): # generator of terms
a, R, maxL = [1], set(), 0 # maxL = max length of first diff.'s stored
for n in count(1):
yield a[-1]
for k in range(1, n+1):
if k > maxL: # must increase length of first diff.'s stored
maxL += 1
R.update(fd(a[i:i+maxL]) for i in range(n-maxL))
if fd(a[-k:]) not in R:
break
an = k
R.update(fd(a[-i:]) for i in range(1, maxL+1))
a.append(an)
print(list(islice(agen(), 90))) # Michael S. Branicky, Oct 16 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Neal Gersh Tolunsky, Oct 16 2024
STATUS
approved