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.

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.

Original entry on oeis.org

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

Views

Author

David James Sycamore, Dec 09 2024

Keywords

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.

Examples

			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.
		

Crossrefs

Programs

  • Maple
    R:= 1: dR:= 1:
    for n from 2 to 100 do
      v:= nops(select(i -> dR[i] >= dR[n-1], [$1..n-1]));
      R:= R,v; dR:= dR, convert(convert(v,base,10),`+`);
    od:
    R; # Robert Israel, Feb 09 2025
  • 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

Extensions

More terms from David A. Corneth, Dec 24 2024