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 A378852 #20 Feb 09 2025 19:14:24 %S A378852 1,1,2,1,4,1,6,1,8,1,10,11,5,3,5,4,6,3,9,1,20,13,9,2,16,4,12,15,7,5, %T A378852 11,23,12,20,26,4,18,3,24,11,32,16,8,6,14,20,38,1,48,1,50,23,24,17,9, %U A378852 6,20,47,3,40,35,12,43,16,17,13,40,41,34,19,4,45,9,10,74,4,49,1,78,1,80 %N A378852 a(1) = 1. For n > 1 a(n) is the number of terms a(i); 1 <= i <= n-1 such that d(a(i)) >= d(a(n-1)), where d is the decimal digital sum function A007953. %C A378852 d(a(n-1)) >= d(a(i)); 1 <= i <= n-1 implies a(n) = 1. a(n) <= n-1 for all n > 1, with equality iff d(a(n-1)) = 1. %C A378852 Compare with A356348 and A378782. %H A378852 Robert Israel, <a href="/A378852/b378852.txt">Table of n, a(n) for n = 1..10000</a> %e A378852 a(1) = 1 so a(2) also = 1 since there is only one term up to and including a(1) = 1 which has digit sum >= 1. Then a(3) = 2 because now there are two terms having digit sum >= 1. a(11) = 10 so a(12) = 11 since all terms up to and including a(11) have digit sum >= 1. a(19) = 9, whose digit sum (9) sets a record, thus a(20) = 1, which means a(21) = 20. %p A378852 R:= 1: dR:= 1: %p A378852 for n from 2 to 100 do %p A378852 v:= nops(select(i -> dR[i] >= dR[n-1], [$1..n-1])); %p A378852 R:= R,v; dR:= dR, convert(convert(v,base,10),`+`); %p A378852 od: %p A378852 R; # _Robert Israel_, Feb 09 2025 %o A378852 (PARI) first(n) = { %o A378852 my(res = vector(n), digs = vector(n)); %o A378852 res[1] = 1; digs[1] = 1; %o A378852 for(i = 2, n, %o A378852 s = 1 + sum(j = 1, i-2, digs[j] >= digs[i-1]); %o A378852 res[i] = s; %o A378852 digs[i] = sumdigits(s) %o A378852 ); %o A378852 res %o A378852 } \\ _David A. Corneth_, Dec 24 2024 %Y A378852 Cf. A007953, A378293, A378782, A356348. %K A378852 nonn,base,look %O A378852 1,3 %A A378852 _David James Sycamore_, Dec 09 2024 %E A378852 More terms from _David A. Corneth_, Dec 24 2024