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”).
%I #16 Nov 27 2024 18:35:52
%S 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,
%T 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,
%U 23,13,31,33,14,32,19,29,12,30,21,32,25,20,16,32
%N 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).
%C We begin with the empty sum 0.
%C This sequence also counts zeros in the decimal expansion of a number.
%H Michael De Vlieger, <a href="/A378359/b378359.txt">Table of n, a(n) for n = 1..10000</a>
%H Michael De Vlieger, <a href="/A378359/a378359.png">Scalar scatterplot of a(n)</a>, n = 1..10^5.
%H Michael De Vlieger, <a href="/A378359/a378359_1.png">Log log scatterplot of a(n)</a>, 1 = 1..10^6.
%H Michael De Vlieger, <a href="/A378359/a378359_2.png">Log log scatterplot of c(d,n-1)</a> for d = 0..9 and n = 1..10^5, with a color function where black indicates d = 0, red d = 1, orange d = 2, ..., purple d = 9.
%e Let c(d) represent c(d,n-1) for concision below:
%e a(2) = 1 since a(1) = 0; c(0) = 1.
%e a(3) = 1 since a(2) = 1; c(1) = 1.
%e a(4) = 2 since a(3) = 1; c(1) = 2.
%e ...
%e a(20) = 10 since a(19) = 1, c(1) = 10.
%e a(21) = 13 since a(20) = 10, c(0)+c(1) = 2+11 = 13.
%e ...
%e a(28) = 20 since a(27) = 19, c(1)+c(9) = 18+2 = 20.
%e a(29) = 5 since a(28) = 20, c(0)+c(2) = 3+2 = 5.
%e ..
%e a(68) = 14 since a(67) = 33, c(3) = 14 (note: not 2*c(3) = 28), etc.
%t nn = 10^4; a[1] = j = 0; c[_] := 0;
%t Do[k = Total@ Map[c[#1] += #2 & @@ # &, Tally@ IntegerDigits[j] ];
%t Set[{a[n], j}, {k, k}], {n, 2, nn}]; Array[a, nn]
%o (PARI)
%o notdoin(d,n) = if(!d && !n, 1, #select(x->x==d,digits(n))); \\ "notdoin" = number of times digit occurs in n
%o 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
%o (Python)
%o from itertools import islice
%o from collections import Counter
%o def agen(): # generator of terms
%o an, c = 0, Counter()
%o while True:
%o yield an
%o s = str(an)
%o c.update(s)
%o an = sum(c[d] for d in set(s))
%o print(list(islice(agen(), 80))) # _Michael S. Branicky_, Nov 25 2024
%Y Cf. A279818.
%K nonn,base,easy
%O 1,4
%A _Michael De Vlieger_ and _David James Sycamore_, Nov 24 2024