

A230427


a(n)=0 if n is in the infinite trunk of factorial beanstalk (in A219666), otherwise the number of nodes (including leaves and the node n itself) in that finite branch of the beanstalk.


8



0, 0, 0, 1, 1, 0, 3, 0, 1, 1, 0, 5, 0, 1, 1, 3, 3, 0, 1, 1, 1, 1, 1, 0, 3, 0, 1, 1, 0, 5, 0, 1, 1, 3, 7, 0, 1, 1, 3, 3, 0, 1, 1, 1, 1, 1, 0, 5, 0, 1, 1, 3, 0, 5, 1, 1, 5, 0, 3, 1, 1, 3, 5, 0, 1, 1, 1, 1, 1, 3, 0, 5, 1, 1, 0, 11, 3, 1, 1, 0, 7, 3, 1, 1, 3, 0, 5
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,7


COMMENTS

This sequence relates to the factorial base representation (A007623) in the same way as A213727 relates to the binary system.


LINKS

Antti Karttunen, Table of n, a(n) for n = 0..10080


FORMULA

If A230412(n)=0, a(n)=1; otherwise, if n is in A219666, a(n)=0; otherwise a(n) = 1 + a(A230423(n)) + a(A230424(n)).
Alternatively, if A230426(n)=0, a(n)=0; otherwise (2*A230426(n))1.


EXAMPLE

From 11 sprouts the following finite sidetree of "factorial beanstalk":
18 19
\ /
14 15
\ /
11
Its leaves are the numbers 14, 18 and 19 (which all occur in A219658), whose factorial base representations (see A007623) are '210', '300' and '301' respectively. The corresponding parent nodes are obtained by subtracting the sum of factorial base digits, thus we get 183 = 15 and also 194 = 15, thus 15 ('211' in factorial base) is the parent of 18 and 19. For 14 and 15 we get 143 = 154 = 11, thus 11 is the parent of both 14 and 15, and the common ancestor of all numbers 11, 14, 15, 18 and 19.
For numbers not occurring in A219666 this sequence gives 1 + the number of all descendant nodes in such subtrees. Thus a(11)=5, a(14)=1 (counting just the leaf 14 itself), a(15)=3 and a(18) = a(19) = 1.


PROG

(Scheme with memoizationmacro definec from Antti Karttunen's IntSeqlibrary)
(definec (A230427 n) (cond ((zero? (A230412 n)) 1) ((inA219666? n) 0) (else (+ 1 (A230427 (A230423 n)) (A230427 (A230424 n))))))
(define (inA219666? n) (or (zero? n) (= 1 ( (A230418 (1+ n)) (A230418 n)))))
;; Alternatively, using A230426:
(define (A230427 n) (if (zero? (A230426 n)) 0 ( (* 2 (A230426 n)) 1)))


CROSSREFS

A219658 gives the position of ones (leaves). Cf. also A230407, A230423A230424, A230425A230426, A230430.
Sequence in context: A263753 A303877 A112743 * A229995 A119467 A166353
Adjacent sequences: A230424 A230425 A230426 * A230428 A230429 A230430


KEYWORD

nonn


AUTHOR

Antti Karttunen, Nov 10 2013


STATUS

approved



