The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A112088 Number of leaf nodes in a binary tree. 79

%I #32 Mar 17 2024 03:12:39

%S 2,3,5,7,11,16,24,36,54,81,122,183,274,411,617,925,1388,2082,3123,

%T 4684,7026,10539,15809,23713,35570,53355,80032,120048,180072,270108,

%U 405162,607743,911615,1367422,2051133,3076700,4615050,6922575,10383862

%N Number of leaf nodes in a binary tree.

%H Seiichi Manyama, <a href="/A112088/b112088.txt">Table of n, a(n) for n = 1..5678</a> (terms 1..1000 from David W. Wilson)

%H Simon Strandgaard, <a href="/A112088/a112088.html">About this sequence</a>

%F a(1)=2; a(n) = floor((5 + Sum_{j=1..n-1} a(j))/2). - _Graeme McRae_, Jun 09 2006

%F a(n) ~ c * 3^n / 2^n, where c = 1.4086393347913639409553312264320529315790457870253974319560288484955... - _Vaclav Kotesovec_, Dec 26 2023

%p a:=2;b:=0;c:=4;p := proc() local x; global a,b,c; x := b + a; c := c - x; if(c<0) then a := a*2; c := c + a*2; end if; b := floor((a*2-c+1) / 2); x end proc: seq(p(), i=0..40);

%t f[n_] := Block[{a = 2, b = 0, c = 4}, Do[x = b + a; c -= x; If[c < 0, a *= 2; c += 2a]; b = Floor[(2a - c + 1)/2], {i, n}]; x]; Array[f, 40] (* _Robert G. Wilson v_, Jan 11 2006 *))

%t f[s_] := Append[s, Ceiling[2 + Plus @@ s/2]]; Nest[f, {2}, 38] (* _Robert G. Wilson v_, Jul 08 2006 *)

%o (Ruby) a,c=2,4;p Array.new(99){c-=x=(a*4-c+1)/2;c+=2*a*=2 if c<0;x}

%o (PARI) first(n)=my(v=vector(n),s); v[1]=s=2; for(n=2,n, s+=v[n]=(s+5)\2); v \\ _Charles R Greathouse IV_, Nov 07 2016

%K easy,nonn

%O 1,1

%A _Simon Strandgaard_, Nov 29 2005

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 13 12:32 EDT 2024. Contains 372519 sequences. (Running on oeis4.)