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.

A370708 a(1)=1; thereafter a(n) is the smallest number > a(n-1) such that no two triples of earlier terms in arithmetic progression have the same common difference.

This page as a plain text file.
%I A370708 #44 Mar 31 2024 02:13:33
%S A370708 1,2,3,5,6,8,12,13,15,16,21,23,28,32,37,38,40,45,47,61,63,70,73,80,81,
%T A370708 91,96,100,103,105,116,123,128,134,138,150,156,157,175,179,181,190,
%U A370708 207,210,214,217,226,240,243,252,256,265,275,281,283,289,292,293,308,315
%N A370708 a(1)=1; thereafter a(n) is the smallest number > a(n-1) such that no two triples of earlier terms in arithmetic progression have the same common difference.
%C A370708 A triple consists of three distinct values in a(1), a(2), ..., a(n).
%C A370708 By definition, no arithmetic progression of length > 3 can occur in the sequence.
%C A370708 What is the density of this sequence?
%H A370708 Michael S. Branicky, <a href="/A370708/b370708.txt">Table of n, a(n) for n = 1..10000</a>
%e A370708 4 is not a term in the sequence because it would create the arithmetic progression (2,3,4), which has the same common difference (1) as the previously occurring triple (1,2,3).
%e A370708 9 is not a term because it would create the arithmetic progression (3,6,9), which has the same common difference (3) as the previously occurring (2,5,8).
%o A370708 (Python)
%o A370708 from itertools import islice
%o A370708 def cd(k, alst, dset, diff_dict):
%o A370708     newdset = set()
%o A370708     for a in alst:
%o A370708         if k-a in diff_dict[a]:
%o A370708             if k-a in dset:
%o A370708                 return False
%o A370708             else:
%o A370708                 newdset.add(k-a)
%o A370708     return True, newdset
%o A370708 def agen(): # generator of terms
%o A370708     alst, dset, an = [1, 2, 3], {1}, 3
%o A370708     yield from alst
%o A370708     diff_dict = {1: set(), 2: {1}, 3: {1, 2}}
%o A370708     while True:
%o A370708         k = an+1
%o A370708         while not (ans:=cd(k, alst, dset, diff_dict)): k += 1
%o A370708         dset.update(ans[1])
%o A370708         an = k
%o A370708         diff_dict[k] = {an-a for a in alst}
%o A370708         alst.append(an)
%o A370708         yield an
%o A370708 print(list(islice(agen(), 60))) # _Michael S. Branicky_, Mar 30 2024
%Y A370708 Cf. A003278.
%K A370708 nonn
%O A370708 1,2
%A A370708 _Neal Gersh Tolunsky_, Mar 25 2024
%E A370708 a(15) and beyond from _Michael S. Branicky_, Mar 30 2024