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.

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

This page as a plain text file.
%I A249009 #29 Dec 14 2022 16:25:51
%S A249009 0,1,1,2,1,3,1,4,1,5,1,6,1,7,1,8,1,9,1,10,11,13,14,15,16,17,18,19,20,
%T A249009 2,3,3,4,3,5,3,6,3,7,3,8,3,9,3,10,21,4,4,5,4,6,4,7,4,8,4,9,4,10,23,5,
%U A249009 5,6,5,7,5,8,5,9,5,10,24,6,6,7,6,8,6,9,6,10
%N A249009 a(n+1) gives the number of occurrences of the first digit of a(n) so far, up to and including a(n), with a(0)=0.
%C A249009 Inspired by A248034.
%H A249009 Alois P. Heinz, <a href="/A249009/b249009.txt">Table of n, a(n) for n = 0..10000</a>
%H A249009 Alois P. Heinz, <a href="/A249009/a249009.jpg">Graph of 10^6 terms</a>
%p A249009 a:= proc(n) option remember; `if`(n=0, 0,
%p A249009       coeff(b(n-1), x, convert(a(n-1), base, 10)[-1] ))
%p A249009     end:
%p A249009 b:= proc(n) option remember; `if`(n=0, 1, b(n-1)+
%p A249009       add(x^i, i=convert(a(n), base, 10)))
%p A249009     end:
%p A249009 seq(a(n), n=0..120);
%o A249009 (MIT/GNU Scheme with memoizing definec-macro from _Antti Karttunen_'s IntSeq-library)
%o A249009 (definec (A249009 n) (if (zero? n) n (vector-ref (A249009aux_digit_counts (- n 1)) (A000030 (A249009 (- n 1))))))
%o A249009 (definec (A249009aux_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 (A249009aux_digit_counts (- n 1)))) (n (A249009 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 A249009 (define (A000030 n) (let loop ((n n)) (if (< n 10) n (loop (floor->exact (/ n 10))))))
%o A249009 ;; _Antti Karttunen_, Oct 20 2014
%o A249009 (Python)
%o A249009 from itertools import islice
%o A249009 def A249009_gen(): # generator of terms
%o A249009     c, clist = 0, [1]+[0]*9
%o A249009     while True:
%o A249009         yield c
%o A249009         c = clist[int(str(c)[0])]
%o A249009         for d in str(c):
%o A249009             clist[int(d)] += 1
%o A249009 A249009_list = list(islice(A249009_gen(),100)) # _Chai Wah Wu_, Dec 13 2022
%Y A249009 Cf. A248034, A000030.
%Y A249009 Cf. A249069 (analogous sequence in factorial base).
%K A249009 nonn,look,base
%O A249009 0,4
%A A249009 _Alois P. Heinz_, Oct 18 2014