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.

A362890 a(1)=a(2)=1. For n>2, a(n) is the number of times that a(n-1) and a(n-2) are adjacent in the sequence thus far (in any order).

This page as a plain text file.
%I A362890 #21 May 10 2023 22:39:08
%S A362890 1,1,1,2,1,2,3,1,1,3,2,2,1,4,1,2,5,1,1,4,3,1,3,4,2,1,6,1,2,7,1,1,5,2,
%T A362890 2,2,3,3,1,5,3,1,6,3,1,7,2,2,4,2,3,4,3,4,5,1,4,4,1,5,5,1,6,4,1,6,5,1,
%U A362890 7,3,1,8,1,2,8,1,3,9,1,1,6,6,1,7,4,1
%N A362890 a(1)=a(2)=1. For n>2, a(n) is the number of times that a(n-1) and a(n-2) are adjacent in the sequence thus far (in any order).
%C A362890 This is a variant of A362746.
%H A362890 Neal Gersh Tolunsky, <a href="/A362890/b362890.txt">Table of n, a(n) for n = 1..10000</a>
%H A362890 Gavin Lupo, <a href="/A362890/a362890.png">Image of the first 100000 terms.</a>
%e A362890 a(4)=2 because a(2) and a(3) = (1, 1) appear as a contiguous pair at 2 locations: at indices (1, 2) and (2, 3).
%e A362890 a(7)=3 because a(5) and a(6) = (1, 2) appear as a contiguous pair at 3 locations: at indices (3, 4), (4, 5), (5, 6).
%o A362890 (Python)
%o A362890 from itertools import islice
%o A362890 from collections import Counter
%o A362890 def k(c, d): return (c, d) if c <= d else (d, c)
%o A362890 def agen(): # generator of terms
%o A362890     an, anext, c = 1, 1, Counter({(1, 1)})
%o A362890     while True:
%o A362890         yield an
%o A362890         an, anext = anext, c[k(an, anext)]
%o A362890         c[k(an, anext)] += 1
%o A362890 print(list(islice(agen(), 100))) # _Michael S. Branicky_, May 09 2023
%Y A362890 Cf. A362746.
%K A362890 nonn
%O A362890 1,4
%A A362890 _Neal Gersh Tolunsky_, May 08 2023