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!)
A083416 Add 1, double, add 1, double, etc. 7

%I #51 Jul 11 2023 07:57:59

%S 1,2,4,5,10,11,22,23,46,47,94,95,190,191,382,383,766,767,1534,1535,

%T 3070,3071,6142,6143,12286,12287,24574,24575,49150,49151,98302,98303,

%U 196606,196607,393214,393215,786430,786431,1572862,1572863,3145726,3145727,6291454

%N Add 1, double, add 1, double, etc.

%H Vincenzo Librandi, <a href="/A083416/b083416.txt">Table of n, a(n) for n = 1..5000</a>

%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (0,3,0,-2).

%F G.f.: x*(1+2*x+x^2-x^3)/(1-x^2)/(1-2*x^2).

%F a(2*n) = 3*2^(n-1)-1, a(2*n+1) = 3*2^n-2.

%F a(n) = A081026(n+1)-1.

%F a(n) = 3*2^((2*n-(-1)^n-3)/4)+((-1)^n-3)/2. - _Bruno Berselli_, Feb 17 2011

%F For n > 1: a(n) = (1 + n mod 2) * a(n-1) + 1 - n mod 2. - _Reinhard Zumkeller_, Feb 27 2012

%F a(2n+1) = A033484(n), a(2n) = A153893(n). - _Philippe Deléham_, Apr 14 2013

%F E.g.f.: (3*cosh(sqrt(2)*x) - 4*sinh(x) + 3*sqrt(2)*sinh(sqrt(2)*x) - 2*cosh(x) - 1)/2. - _Stefano Spezia_, Jul 11 2023

%p A083416 := proc(n) if type(n,'even') then 3*2^(n/2-1)-1 ; else 3*2^((n-1)/2)-2 ; end if; end proc: # _R. J. Mathar_, Feb 16 2011

%t a=0; b=0; lst={a,b}; Do[z=a+b+1; AppendTo[lst,z]; a=b; b=z; z=b+1; AppendTo[lst,z]; a=b; b=z,{n,50}]; lst (* _Vladimir Joseph Stephan Orlovsky_, Feb 16 2010 *)

%t LinearRecurrence[{0,3,0,-2},{1,2,4,5},40] (* _Harvey P. Dale_, Nov 18 2014 *)

%o (Magma) [Floor(3*2^((2*n-(-1)^n-3)/4)+((-1)^n-3)/2): n in [1..50]]; // _Vincenzo Librandi_, Aug 17 2011

%o (Haskell)

%o a083416 n = a083416_list !! (n-1)

%o a083416_list = 1 : f 2 1 where

%o f x y = z : f (x+1) z where z = (1 + x `mod` 2) * y + 1 - x `mod` 2

%o -- _Reinhard Zumkeller_, Feb 27 2012

%Y Cf. A033484, A081026, A153893.

%K easy,nonn

%O 1,2

%A _N. J. A. Sloane_, Jun 10 2003

%E More terms from Donald Sampson (marsquo(AT)hotmail.com), Dec 04 2003

%E Corrected by _T. D. Noe_, Nov 02 2006

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 04:42 EDT 2024. Contains 371964 sequences. (Running on oeis4.)