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.

A083416 Add 1, double, add 1, double, etc.

Original entry on oeis.org

1, 2, 4, 5, 10, 11, 22, 23, 46, 47, 94, 95, 190, 191, 382, 383, 766, 767, 1534, 1535, 3070, 3071, 6142, 6143, 12286, 12287, 24574, 24575, 49150, 49151, 98302, 98303, 196606, 196607, 393214, 393215, 786430, 786431, 1572862, 1572863, 3145726, 3145727, 6291454
Offset: 1

Views

Author

N. J. A. Sloane, Jun 10 2003

Keywords

Crossrefs

Programs

  • Haskell
    a083416 n = a083416_list !! (n-1)
    a083416_list = 1 : f 2 1 where
       f x y = z : f (x+1) z where z = (1 + x `mod` 2) * y + 1 - x `mod` 2
    -- Reinhard Zumkeller, Feb 27 2012
  • Magma
    [Floor(3*2^((2*n-(-1)^n-3)/4)+((-1)^n-3)/2): n in [1..50]]; // Vincenzo Librandi, Aug 17 2011
    
  • Maple
    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
  • Mathematica
    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 *)
    LinearRecurrence[{0,3,0,-2},{1,2,4,5},40] (* Harvey P. Dale, Nov 18 2014 *)

Formula

G.f.: x*(1+2*x+x^2-x^3)/(1-x^2)/(1-2*x^2).
a(2*n) = 3*2^(n-1)-1, a(2*n+1) = 3*2^n-2.
a(n) = A081026(n+1)-1.
a(n) = 3*2^((2*n-(-1)^n-3)/4)+((-1)^n-3)/2. - Bruno Berselli, Feb 17 2011
For n > 1: a(n) = (1 + n mod 2) * a(n-1) + 1 - n mod 2. - Reinhard Zumkeller, Feb 27 2012
a(2n+1) = A033484(n), a(2n) = A153893(n). - Philippe Deléham, Apr 14 2013
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

Extensions

More terms from Donald Sampson (marsquo(AT)hotmail.com), Dec 04 2003
Corrected by T. D. Noe, Nov 02 2006