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.

A248034 a(n+1) gives the number of occurrences of the last digit of a(n) so far, up to and including a(n), with a(0)=0.

This page as a plain text file.
%I A248034 #74 Dec 23 2024 14:53:44
%S A248034 0,1,1,2,1,3,1,4,1,5,1,6,1,7,1,8,1,9,1,10,2,2,3,2,4,2,5,2,6,2,7,2,8,2,
%T A248034 9,2,10,3,3,4,3,5,3,6,3,7,3,8,3,9,3,10,4,4,5,4,6,4,7,4,8,4,9,4,10,5,5,
%U A248034 6,5,7,5,8,5,9,5,10,6,6,7,6,8,6,9,6,10,7,7,8,7,9,7,10,8,8,9,8,10,9,9,10
%N A248034 a(n+1) gives the number of occurrences of the last digit of a(n) so far, up to and including a(n), with a(0)=0.
%C A248034 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.
%H A248034 Alois P. Heinz, <a href="/A248034/b248034.txt">Table of n, a(n) for n = 0..10000</a>
%H A248034 Eric Angelini, <a href="https://web.archive.org/web/*/http://list.seqfan.eu/oldermail/seqfan/2014-October/013784.html">Digit-counters updating themselves</a>, SeqFan list, Oct 11 2014.
%H A248034 Zak Seidov, <a href="/A248034/a248034.jpg">Graph of 10^6 terms</a>
%p A248034 a:= proc(n) option remember; `if`(n=0, 0,
%p A248034       coeff(b(n-1), x, irem(a(n-1), 10)))
%p A248034     end:
%p A248034 b:= proc(n) option remember; `if`(n=0, 1, b(n-1)+
%p A248034       add(x^i, i=convert(a(n), base, 10)))
%p A248034     end:
%p A248034 seq(a(n), n=0..120);  # _Alois P. Heinz_, Oct 18 2014
%t A248034 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 *)
%o A248034 (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]))
%o A248034 (MIT/GNU Scheme)
%o A248034 ;; An implementation of memoization-macro definec can be found for example from: http://oeis.org/wiki/Memoization
%o A248034 (definec (A248034 n) (if (zero? n) n (vector-ref (A248034aux_digit_counts (- n 1)) (modulo (A248034 (- n 1)) 10))))
%o A248034 (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)))))))))
%o A248034 ;; _Antti Karttunen_, Oct 22 2014
%o A248034 (Python)
%o A248034 from itertools import islice
%o A248034 def A248034_gen(): # generator of terms
%o A248034     c, clist = 0, [1]+[0]*9
%o A248034     while True:
%o A248034         yield c
%o A248034         c = clist[c%10]
%o A248034         for d in str(c):
%o A248034             clist[int(d)] += 1
%o A248034 A248034_list = list(islice(A248034_gen(),30)) # _Chai Wah Wu_, Dec 13 2022
%Y A248034 Cf. A249068 (analogous sequence in base 8).
%Y A248034 Cf. A249009 (analogous sequence which uses the first, not the last digit).
%Y A248034 Cf. A249069, A249070, A249144, A249148, A364788.
%K A248034 nonn,base,look,hear
%O A248034 0,4
%A A248034 _Eric Angelini_ and _M. F. Hasler_, Oct 11 2014