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!)
A033497 a(n) = 2*a(n-1) + a(floor(n/2)), with a(1) = 1, a(2) = 2, a(3) = 4. 2

%I #21 Sep 08 2022 08:44:51

%S 1,2,4,10,22,48,100,210,430,882,1786,3620,7288,14676,29452,59114,

%T 118438,237306,475042,950966,1902814,3807414,7616614,15236848,

%U 30477316,60961920,121931128,243876932,487768540,975566532,1951162516,3902384146,7804827406,15609773250

%N a(n) = 2*a(n-1) + a(floor(n/2)), with a(1) = 1, a(2) = 2, a(3) = 4.

%H Harvey P. Dale, <a href="/A033497/b033497.txt">Table of n, a(n) for n = 1..1000</a>

%p A033497 := proc(n) option remember; if n <= 3 then 2^(n-1) else A033497(n-1)+A033497(round(2*(n-1)/2))+A033497(round((n-1)/2)); fi; end;

%t a[1]=1;a[2]=2;a[3]=4;a[n_]:=a[n]=2a[n-1]+a[Floor[n/2]]; Array[a,40] (* _Harvey P. Dale_, Aug 08 2019 *)

%t a[n_]:= a[n]= If[n<4, 2^(n-1), 2*a[n-1] + a[Floor[n/2]]]; Table[a[n], {n, 40}] (* _G. C. Greubel_, Oct 14 2019 *)

%o (PARI) a=vector(99,i,i*(i-1)/2+1);for(n=4,#a,a[n]=2*a[n-1]+a[n\2]);a \\ _Charles R Greathouse IV_, Nov 29 2011

%o (Magma) a:= func< n | n lt 4 select 2^(n-1) else 2*Self(n-1) + Self(Floor(n/2)) >;

%o [a(n): n in [1..40]]; // _G. C. Greubel_, Oct 14 2019

%o (Sage)

%o @CachedFunction

%o def a(n):

%o if (n<4): return 2^(n-1)

%o else: return 2*a(n-1) +a(floor(n/2))

%o [a(n) for n in (1..40)] # _G. C. Greubel_, Oct 14 2019

%o (GAP)

%o a:= function(n)

%o if n<4 then return 2^(n-1);

%o else return 2*a(n-1) + a(Int(n/2));

%o fi;

%o end;

%o List([1..40], n-> a(n) ); # _G. C. Greubel_, Oct 14 2019

%Y Cf. A033489, A033490.

%K nonn,easy

%O 1,2

%A _N. J. A. Sloane_

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 April 25 05:56 EDT 2024. Contains 371964 sequences. (Running on oeis4.)