cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A375207 a(1)=1; thereafter a(n) is the smallest k for which the subsequence a(n-k..n-1) has a distinct sequence of first differences from that of any other subsequence of the sequence thus far.

This page as a plain text file.
%I A375207 #11 Nov 02 2024 00:05:33
%S A375207 1,1,2,2,3,4,3,2,3,3,4,5,6,4,2,3,3,4,5,6,7,5,6,4,4,3,3,3,3,4,4,5,6,7,
%T A375207 7,4,2,3,4,4,5,5,5,4,4,5,4,4,4,5,5,6,7,8,9,8,5,3,4,5,6,5,6,4,4,5,4,5,
%U A375207 5,5,5,5,5,6,6,7,8,9,10,10,6,2,3,3,4,5,6,7
%N A375207 a(1)=1; thereafter a(n) is the smallest k for which the subsequence a(n-k..n-1) has a distinct sequence of first differences from that of any other subsequence of the sequence thus far.
%C A375207 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.
%H A375207 Neal Gersh Tolunsky, <a href="/A375207/b375207.txt">Table of n, a(n) for n = 1..10000</a>
%H A375207 Neal Gersh Tolunsky, <a href="/A375207/a375207.png">Ordinal Transform of 500000 terms</a>
%e A375207 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.
%e A375207 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).
%o A375207 (Python)
%o A375207 from itertools import count, islice
%o A375207 def fd(t): return tuple(t[i]-t[i-1] for i in range(1, len(t)))
%o A375207 def agen(): # generator of terms
%o A375207     a, R, maxL = [1], set(), 0  # maxL = max length of first diff.'s stored
%o A375207     for n in count(1):
%o A375207         yield a[-1]
%o A375207         for k in range(1, n+1):
%o A375207             if k > maxL:  # must increase length of first diff.'s stored
%o A375207                 maxL += 1
%o A375207                 R.update(fd(a[i:i+maxL]) for i in range(n-maxL))
%o A375207             if fd(a[-k:]) not in R:
%o A375207                 break
%o A375207         an = k
%o A375207         R.update(fd(a[-i:]) for i in range(1, maxL+1))
%o A375207         a.append(an)
%o A375207 print(list(islice(agen(), 90))) # _Michael S. Branicky_, Oct 16 2024
%Y A375207 Cf. A377079, A376937.
%K A375207 nonn
%O A375207 1,3
%A A375207 _Neal Gersh Tolunsky_, Oct 16 2024