login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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.
0
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, 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, 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
OFFSET
1,3
COMMENTS
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.
Compare with A356348 and A378782.
EXAMPLE
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.
PROG
(PARI) first(n) = {
my(res = vector(n), digs = vector(n));
res[1] = 1; digs[1] = 1;
for(i = 2, n,
s = 1 + sum(j = 1, i-2, digs[j] >= digs[i-1]);
res[i] = s;
digs[i] = sumdigits(s)
);
res
} \\ David A. Corneth, Dec 24 2024
CROSSREFS
KEYWORD
nonn,base,new
AUTHOR
EXTENSIONS
More terms from David A. Corneth, Dec 24 2024
STATUS
approved