OFFSET
1,4
COMMENTS
We begin with the empty sum 0.
This sequence also counts zeros in the decimal expansion of a number.
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
Michael De Vlieger, Scalar scatterplot of a(n), n = 1..10^5.
Michael De Vlieger, Log log scatterplot of a(n), 1 = 1..10^6.
Michael De Vlieger, Log log scatterplot of c(d,n-1) 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.
EXAMPLE
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.
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]
PROG
(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
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Michael De Vlieger and David James Sycamore, Nov 24 2024
STATUS
approved