OFFSET
0,4
COMMENTS
In other words, the number to the right of a comma gives the number of occurrences of the digit immediately to the left of the comma, counting from the beginning up to that digit or comma.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..10000
Eric Angelini, Digit-counters updating themselves, SeqFan list, Oct 11 2014.
Zak Seidov, Graph of 10^6 terms
MAPLE
a:= proc(n) option remember; `if`(n=0, 0,
coeff(b(n-1), x, irem(a(n-1), 10)))
end:
b:= proc(n) option remember; `if`(n=0, 1, b(n-1)+
add(x^i, i=convert(a(n), base, 10)))
end:
seq(a(n), n=0..120); # Alois P. Heinz, Oct 18 2014
MATHEMATICA
nn = 120; a[0] = j = 0; c[_] := 0; Do[Map[c[#]++ &, IntegerDigits[j]]; a[n] = j = c[Mod[j, 10]], {n, nn}]; Array[a, nn, 0] (* Michael De Vlieger, Aug 07 2023 *)
PROG
(PARI) c=vector(10); print1(a=0); for(n=1, 99, apply(d->c[d+1]++, if(a, digits(a))); print1(", "a=c[1+a%10]))
(MIT/GNU Scheme)
;; An implementation of memoization-macro definec can be found for example from: http://oeis.org/wiki/Memoization
(definec (A248034 n) (if (zero? n) n (vector-ref (A248034aux_digit_counts (- n 1)) (modulo (A248034 (- n 1)) 10))))
(definec (A248034aux_digit_counts n) (cond ((zero? n) (vector 1 0 0 0 0 0 0 0 0 0)) (else (let loop ((digcounts-for-n (vector-copy (A248034aux_digit_counts (- n 1)))) (n (A248034 n))) (cond ((zero? n) digcounts-for-n) (else (vector-set! digcounts-for-n (modulo n 10) (+ 1 (vector-ref digcounts-for-n (modulo n 10)))) (loop digcounts-for-n (floor->exact (/ n 10)))))))))
;; Antti Karttunen, Oct 22 2014
(Python)
from itertools import islice
def A248034_gen(): # generator of terms
c, clist = 0, [1]+[0]*9
while True:
yield c
c = clist[c%10]
for d in str(c):
clist[int(d)] += 1
CROSSREFS
AUTHOR
Eric Angelini and M. F. Hasler, Oct 11 2014
STATUS
approved