OFFSET
0,3
COMMENTS
Each a(n) = 1 + the count of nodes in the finite subtree defined by the edge relation parent = child + A000120(child). In other words, one more than the count of n's descendants, by which we mean the whole transitive closure of all children emanating from the parent at n. The subtree is finite because successive descendant values get smaller and approach zero.
LINKS
Andres M. Torres, Table of n, a(n) for n = 0..9999
Andres M. Torres, Blitz3D Basic code for computing this sequence
FORMULA
EXAMPLE
0 has no children distinct from itself (we only have A092391(0)=0), so we define a(0) = (0+1) = 1,
1 has no children (it is one of the terms of A010061), so a(1) = (0+1) = 1,
4 and 6 are also members of A010061, so both a(4) and a(6) = (0+1) = 1,
7 has 1,2,3,4 and 5 among its descendants (as A092391(5)=7, A092391(3)=A092391(4)=5, A092391(2)=3, A092391(1)=2), so a(7) = (5+1) = 6,
8 has 6 as a child value, so a(8) = (1+1) = 2,
9 has 6 and 8 as descendants, so a(9) = (2+1) = 3,
10 has {1,2,3,4,5,7} so a(10) = (6+1) = 7.
PROG
(Scheme)
;; A deficient definition which works only up to n=128:
(definec (A227643deficient n) (cond ((zero? n) 1) ((zero? (A228085 n)) 1) ((= 1 (A228085 n)) (+ 1 (A227643deficient (A228086 n)))) ((= 2 (A228085 n)) (+ 1 (A227643deficient (A228086 n)) (A227643deficient (A228087 n)))) (else (error "Not yet implemented for cases where n has more than two immediate children!"))))
;; Another definition that works for all n, but is somewhat slower:
(definec (A227643full n) (cond ((zero? n) 1) (else (+ 1 (add (lambda (i) (if (= (A092391 i) n) (A227643full i) 0)) (A228086 n) (A228087 n))))))
;; Auxiliary function add implements sum_{i=lowlim..uplim} intfun(i)
(define (add intfun lowlim uplim) (let sumloop ((i lowlim) (res 0)) (cond ((> i uplim) res) (else (sumloop (1+ i) (+ res (intfun i)))))))
;; by Antti Karttunen, Aug 16 2013, macro definec can be found in his IntSeq-library.
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Andres M. Torres, Jul 18 2013
STATUS
approved