OFFSET
0,4
LINKS
Antti Karttunen, Table of n, a(n) for n = 0..10080
EXAMPLE
a(0) = 0 (by definition)
a(1) = 1 ('1' in factorial base), as 0 has occurred once in all the preceding terms.
a(2) = 1 as 1 has occurred once in all the preceding terms.
a(3) = 2 ('10' in factorial base), as digit '1' has occurred two times in total in all the preceding terms.
a(4) = 3 ('11' in factorial base), as '1' occurs once in each a(1) and a(2) and a(3).
a(5) = 5 ('21' in factorial base), as '1' occurs once in each of a(1), a(2) and a(3) and twice at a(4).
a(6) = 1 ('1' in factorial base), as '2' so far occurs only once at a(5)
a(7) = 7 = '101'
a(8) = 9 = '111'
a(9) = 12 = '200'
a(10) = 2 = '2'
a(11) = 13 = '201'
a(12) = 3 = '11'
a(12) = 3 = '11'
a(13) = 16 = '220'
a(14) = 5 = '21'
a(15) = 6 = '100'
a(16) = 18 = '300'
a(17) = 1 = '1'
a(18) = 19 = '301'
a(19) = 2 = '10'
a(20) = 21 = '311'
a(21) = 3 = '11'
a(22) = 25 = '1001'
a(23) = 27 = '1011'
a(24) = 30 = '1100'
a(25) = 32 = '1110'
a(26) = 35 = '1121'
a(27) = 7 (= '101' in factorial base), as the maximum digit in the factorial base representation of a(26), namely '2', has occurred in total 7 times in terms a(0) - a(26): once in each of a(5), a(9), a(11), a(14) and a(26), and twice in a(13).
PROG
(MIT/GNU Scheme with memoizing definec-macro from Antti Karttunen's IntSeq-library)
(definec (A249070 n) (if (zero? n) n (vector-ref (A249070aux_digit_counts (- n 1)) (A246359 (A249070 (- n 1))))))
(definec (A249070aux_digit_counts n) (cond ((zero? n) (vector 1)) (else (let* ((start_n (A249070 n)) (copy-of-prevec (vector-copy (A249070aux_digit_counts (- n 1)))) (newsize (max (vector-length copy-of-prevec) (+ 1 (A246359 start_n)))) (digcounts-for-n (vector-grow copy-of-prevec newsize))) (let loop ((n start_n) (i 2)) (cond ((zero? n) digcounts-for-n) (else (vector-set! digcounts-for-n (modulo n i) (+ 1 (or (vector-ref digcounts-for-n (modulo n i)) 0))) (loop (floor->exact (/ n i)) (+ i 1)))))))))
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Oct 20 2014
STATUS
approved