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.

A227643 a(0)=1; for n > 0, a(n) = 1 + Sum_{i=A228086(n)..A228087(n)} [A092391(i) = n]*a(i), where [] is the Iverson bracket, resulting in 1 when i + A000120(i) = n and 0 otherwise.

This page as a plain text file.
%I A227643 #63 Oct 07 2023 08:45:24
%S A227643 1,1,2,3,1,5,1,6,2,3,7,4,8,1,13,1,2,16,1,18,2,1,21,1,2,22,3,2,23,4,1,
%T A227643 26,1,6,2,7,29,1,37,1,2,38,3,2,39,4,1,42,1,5,3,1,48,4,1,50,1,5,2,2,51,
%U A227643 6,3,1,54,55,7,59,8,2,68,1,3,69,4,2,70,5,1,73,1
%N A227643 a(0)=1; for n > 0, a(n) = 1 + Sum_{i=A228086(n)..A228087(n)} [A092391(i) = n]*a(i), where [] is the Iverson bracket, resulting in 1 when i + A000120(i) = n and 0 otherwise.
%C A227643 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.
%H A227643 Andres M. Torres, <a href="/A227643/b227643.txt">Table of n, a(n) for n = 0..9999</a>
%H A227643 Andres M. Torres, <a href="/A227643/a227643.bb.txt">Blitz3D Basic code for computing this sequence</a>
%H A227643 <a href="/index/Coi#Colombian">Index entries for Colombian or self numbers and related sequences</a>
%F A227643 From _Antti Karttunen_, Aug 16 2013: (Start)
%F A227643 a(0)=1; and for n > 0, if A228085(n)=0 then a(n)=1; if A228085(n)=1 then a(n)=1+a(A228086(n)); if A228085(n)=2 then a(n)=1+a(A228086(n))+a(A228087(n)); otherwise (when A228085(n)>2) cannot be computed with this formula, which works only up to n=128.
%F A227643 a(0)=1; and for n > 0, a(n) = 1+Sum_{i=A228086(n)..A228087(n)} [A092391(i) = n]*a(i). (Here [...] denotes the Iverson bracket, resulting in 1 when i+A000120(i) = n and 0 otherwise. This formula works with all n.) (End)
%e A227643 0 has no children distinct from itself (we only have A092391(0)=0), so we define a(0) = (0+1) = 1,
%e A227643 1 has no children (it is one of the terms of A010061), so a(1) = (0+1) = 1,
%e A227643 4 and 6 are also members of A010061, so both a(4) and a(6) = (0+1) = 1,
%e A227643 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,
%e A227643 8 has 6 as a child value,        so a(8) = (1+1) = 2,
%e A227643 9 has 6 and 8 as descendants,    so a(9) = (2+1) = 3,
%e A227643 10 has {1,2,3,4,5,7}             so a(10) = (6+1) = 7.
%o A227643 (Scheme)
%o A227643 ;; A deficient definition which works only up to n=128:
%o A227643 (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!"))))
%o A227643 ;; Another definition that works for all n, but is somewhat slower:
%o A227643 (definec (A227643full n) (cond ((zero? n) 1) (else (+ 1 (add (lambda (i) (if (= (A092391 i) n) (A227643full i) 0)) (A228086 n) (A228087 n))))))
%o A227643 ;; Auxiliary function add implements sum_{i=lowlim..uplim} intfun(i)
%o A227643 (define (add intfun lowlim uplim) (let sumloop ((i lowlim) (res 0)) (cond ((> i uplim) res) (else (sumloop (1+ i) (+ res (intfun i)))))))
%o A227643 ;; by _Antti Karttunen_, Aug 16 2013, macro definec can be found in his IntSeq-library.
%Y A227643 Cf. A010061 (gives the positions of ones), A000120, A092391, A228082, A228083, A228085, A227359, A227361, A227408.
%Y A227643 Cf. also A213727 for a descendant counts for a similar tree defined by the edge relation parent = child - A000120(child).
%K A227643 nonn,base
%O A227643 0,3
%A A227643 _Andres M. Torres_, Jul 18 2013