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).
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
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.
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.
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
Comments