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.
%I A379250 #26 Dec 22 2024 09:29:22 %S A379250 1,1,2,1,2,1,2,3,2,3,2,3,2,3,3,3,3,3,4,3,4,3,4,3,4,5,6,7,8,7,8,7,8,7, %T A379250 8,7,6,5,4,3,3,3,3,3,3,3,3,3,3,3,4,6,6,8,8,10,10,11,12,12,13,12,12,11, %U A379250 12,12,11,12,12,12,12,12,12,11,11,10,11,9,9,7 %N A379250 a(1)=1; thereafter, a(n) is the number of coincidences between the sequence thus far and its terms rearranged in descending order. %C A379250 Equivalently, this is the number of coincidences between the reverse of the sequence and its terms rearranged in ascending order. %H A379250 Neal Gersh Tolunsky, <a href="/A379250/b379250.txt">Table of n, a(n) for n = 1..10000</a> %H A379250 Pontus von Brömssen, <a href="/A379250/a379250.png">Plot of n, a(n) for n = 1..100000</a>. %e A379250 To find a(8), we compare the first 7 terms of the sequence with the same terms arranged in descending order: %e A379250 1, 1, 2, 1, 2, 1, 2 %e A379250 2, 2, 2, 1, 1, 1, 1 %e A379250 ^ ^ ^ %e A379250 We find three coincidences, so a(8) = 3. %t A379250 Nest[Append[#,Count[#-Reverse[Sort[#]],0]]&,{1},79] (* _James C. McMahon_, Dec 21 2024 *) %o A379250 (Python) %o A379250 from bisect import insort %o A379250 from itertools import islice %o A379250 def agen(): # generator of terms %o A379250 a, d, an = [], [], 1 %o A379250 while True: %o A379250 a.append(an) %o A379250 insort(d, an, key=lambda x: -x) %o A379250 yield an %o A379250 an = sum(1 for x, y in zip(a, d) if x == y) %o A379250 print(list(islice(agen(), 80))) # _Michael S. Branicky_, Dec 21 2024 %Y A379250 Cf. A276638, A379265, A379266. %K A379250 nonn %O A379250 1,3 %A A379250 _Neal Gersh Tolunsky_, Dec 17 2024