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.

A362746 a(1)=a(2)=1; a(n)=The count of all occurrences in the list so far where integer a(n-1) appears adjacent to integer a(n-2).

This page as a plain text file.
%I A362746 #52 May 10 2023 22:38:41
%S A362746 1,1,2,1,2,2,2,3,1,1,4,1,2,3,2,3,3,2,4,1,3,2,5,1,1,6,1,2,4,2,3,6,1,3,
%T A362746 3,4,1,4,4,2,4,4,4,5,1,2,5,2,3,7,1,1,8,1,2,6,1,4,5,2,4,5,3,1,4,6,1,5,
%U A362746 3,2,8,1,3,5,3,4,2,6,2,3,9,1,1,10,1,2,7
%N A362746 a(1)=a(2)=1; a(n)=The count of all occurrences in the list so far where integer a(n-1) appears adjacent to integer a(n-2).
%H A362746 Gavin Lupo, <a href="/A362746/b362746.txt">Table of n, a(n) for n = 1..10000</a>
%H A362746 Gavin Lupo, <a href="/A362746/a362746_3.png">Image of the first 100000 terms.</a>
%e A362746 a(1) = 1.
%e A362746 a(2) = 1.
%e A362746 a(3) = 2. How many 1's so far are adjacent to a 1? = 2.
%e A362746 a(4) = 1. How many 2's so far are adjacent to a 1? = 1.
%e A362746 a(5) = 2. How many 1's so far are adjacent to a 2? = 2.
%e A362746 a(6) = 2. How many 2's so far are adjacent to a 1? = 2.
%t A362746 K = {1, 1}; While[Length@K < 87, A = Position[K, Last@K]; c = 0; For[a = 1, a <= Length@A, a++, If[K[[A[[a]] - 1]] == {K[[Length@K - 1]]} || K[[A[[a]] + 1]] == {K[[Length@K - 1]]}, c++]]; AppendTo[K, c]]; Print[K] (* _Samuel Harkness_, May 08 2023 *)
%o A362746 (Python)
%o A362746 from itertools import islice
%o A362746 from collections import Counter
%o A362746 def agen(): # generator of terms
%o A362746     aprev, an, anext, c = 0, 1, 1, Counter({(1, 1)})
%o A362746     while True:
%o A362746         aprev, an, anext = an, anext, c[an, anext]
%o A362746         c[an, anext] += 1
%o A362746         if aprev != anext: c[anext, an] +=  1
%o A362746         yield an
%o A362746 print(list(islice(agen(), 100))) # _Michael S. Branicky_, May 02 2023
%Y A362746 Cf. A342585, A355271, A362890.
%K A362746 nonn,easy,look
%O A362746 1,3
%A A362746 _Gavin Lupo_, May 01 2023