OFFSET
0,3
COMMENTS
a(n) tells in what number we end in n steps, when we start climbing up the infinite trunk of the "factorial beanstalk" from its root (zero).
There are many finite sequences such as 0,1,2,4; 0,1,2,5,6; etc. obeying the same condition (see A219659) and as the length increases, so (necessarily) does the similarity to this infinite sequence.
See A007623 for the factorial number system representation.
LINKS
Antti Karttunen, Table of n, a(n) for n = 0..21622
FORMULA
MATHEMATICA
nn = 10^3; m = 1; While[m! < Floor[6 nn/5], m++]; m; t = TakeWhile[Reverse@ NestWhileList[# - Total@ IntegerDigits[#, MixedRadix[Reverse@ Range[2, m]]] &, Floor[6 nn/5], # > 0 &], # <= nn &] (* Michael De Vlieger, Jun 27 2016, Version 10.2 *)
PROG
(Scheme) ;; Memoizing definec-macro from Antti Karttunen's IntSeq-library
(definec (A219666 n) (cond ((<= n 2) n) ((= (A226061 (A230411 n)) n) (- (A000142 (A230411 n)) 1)) (else (- (A219666 (+ n 1)) (A034968 (A219666 (+ n 1)))))))
;; Another variant, utilizing A230416 (which gives a more convenient way to compute large number of terms of this sequence):
;; This function is for checking whether n belongs to this sequence:
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Nov 25 2012
STATUS
approved