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.

A378359 a(1) = 0, a(n) = Sum_{digits d in a(n-1)} c(d,n-1), where c(d,k) is the number of digits d in a(1..k).

Original entry on oeis.org

0, 1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 1, 8, 1, 9, 1, 10, 13, 14, 15, 16, 17, 18, 19, 20, 5, 3, 3, 4, 3, 5, 4, 4, 5, 5, 6, 3, 6, 4, 6, 5, 7, 3, 7, 4, 7, 5, 8, 3, 8, 4, 8, 5, 9, 3, 9, 4, 9, 5, 10, 23, 13, 31, 33, 14, 32, 19, 29, 12, 30, 21, 32, 25, 20, 16, 32
Offset: 1

Views

Author

Keywords

Comments

We begin with the empty sum 0.
This sequence also counts zeros in the decimal expansion of a number.

Examples

			Let c(d) represent c(d,n-1) for concision below:
a(2) = 1 since a(1) = 0; c(0) = 1.
a(3) = 1 since a(2) = 1; c(1) = 1.
a(4) = 2 since a(3) = 1; c(1) = 2.
...
a(20) = 10 since a(19) = 1, c(1) = 10.
a(21) = 13 since a(20) = 10, c(0)+c(1) = 2+11 = 13.
...
a(28) = 20 since a(27) = 19, c(1)+c(9) = 18+2 = 20.
a(29) = 5 since a(28) = 20, c(0)+c(2) = 3+2 = 5.
..
a(68) = 14 since a(67) = 33, c(3) = 14 (note: not 2*c(3) = 28), etc.
		

Crossrefs

Cf. A279818.

Programs

  • Mathematica
    nn = 10^4; a[1] = j = 0; c[_] := 0;
    Do[k = Total@ Map[c[#1] += #2 & @@ # &, Tally@ IntegerDigits[j] ];
      Set[{a[n], j}, {k, k}], {n, 2, nn}]; Array[a, nn]
  • PARI
    notdoin(d,n) = if(!d && !n, 1, #select(x->x==d,digits(n))); \\ "notdoin" = number of times digit occurs in n
    A378359list(up_to_n) = { my(v=vector(up_to_n)); v[1] = 0; for(n=2, up_to_n, my(digs = if(2==n,[0],vecsort(digits(v[n-1]),,8))); v[n] = sum(i=1,#digs,sum(j=1,n-1,notdoin(digs[i],v[j])))); (v); }; \\ Antti Karttunen, Nov 25 2024
    
  • Python
    from itertools import islice
    from collections import Counter
    def agen(): # generator of terms
        an, c = 0, Counter()
        while True:
            yield an
            s = str(an)
            c.update(s)
            an = sum(c[d] for d in set(s))
    print(list(islice(agen(), 80))) # Michael S. Branicky, Nov 25 2024