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 A379375 #20 Jan 03 2025 11:47:29 %S A379375 0,1,0,1,2,1,2,1,2,2,2,3,2,3,2,3,4,5,4,5,4,5,4,3,2,2,2,2,2,2,2,3,5,5, %T A379375 7,7,9,9,9,8,8,7,8,8,10,9,8,8,7,6,4,3,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3, %U A379375 3,3,3,3,4,4,4,4,4,4,4,5,7,7,7,8,8,9,9 %N A379375 a(n) is the number of coincidences between the sequence thus far and its terms rearranged in descending order. %C A379375 Equivalently, this is the number of coincidences between the reverse of the sequence and its terms rearranged in ascending order. %C A379375 A379250 is a variant beginning with 1. %H A379375 Neal Gersh Tolunsky, <a href="/A379375/b379375.txt">Table of n, a(n) for n = 1..10000</a> %H A379375 Neal Gersh Tolunsky, <a href="/A379375/a379375.png">Graph of 100000 terms</a> %e A379375 To find a(5), we compare the first 4 terms of the sequence with the same terms arranged in descending order: %e A379375 0, 1, 0, 1 %e A379375 1, 1, 0, 0 %e A379375 ^ ^ %e A379375 We find 2 coincidences, so a(5) = 2. %p A379375 A:= [0]: %p A379375 S:= [0]: %p A379375 for n from 2 to 100 do %p A379375 m:= numboccur(0,A+S); %p A379375 A:= [op(A),m]; %p A379375 j:= ListTools:-BinaryPlace(S,-m); %p A379375 S:= [op(S[1..j]),-m,op(S[j+1..-1])]; %p A379375 od: %p A379375 A; # _Robert Israel_, Dec 22 2024 %t A379375 Nest[Append[#,Count[#-Reverse[Sort[#]],0]]&,{},87] (* _James C. McMahon_, Jan 03 2025 *) %o A379375 (Python) %o A379375 from bisect import insort %o A379375 from itertools import islice %o A379375 def agen(): # generator of terms %o A379375 a, d, an = [], [], 0 %o A379375 while True: %o A379375 a.append(an) %o A379375 insort(d, an, key=lambda x: -x) %o A379375 yield an %o A379375 an = sum(1 for x, y in zip(a, d) if x == y) %o A379375 print(list(islice(agen(), 87))) # _Michael S. Branicky_, Dec 21 2024 %Y A379375 Cf. A379250. %K A379375 nonn %O A379375 1,5 %A A379375 _Neal Gersh Tolunsky_, Dec 21 2024