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.

A075427 a(0) = 1; a(n) = a(n-1)+1 if n is even, otherwise a(n) = 2*a(n-1).

Original entry on oeis.org

1, 2, 3, 6, 7, 14, 15, 30, 31, 62, 63, 126, 127, 254, 255, 510, 511, 1022, 1023, 2046, 2047, 4094, 4095, 8190, 8191, 16382, 16383, 32766, 32767, 65534, 65535, 131070, 131071, 262142, 262143, 524286, 524287, 1048574, 1048575, 2097150, 2097151, 4194302, 4194303, 8388606
Offset: 0

Views

Author

Reinhard Zumkeller, Sep 15 2002

Keywords

Comments

Fixed points for permutations A180200, A180201, A180198, and A180199. - Reinhard Zumkeller, Aug 15 2010
The Kn22 sums, see A180662, of triangle A194005 equal the terms of this sequence. - Johannes W. Meijer, Aug 16 2011

Crossrefs

Cf. A075426, A066880, A083416, A000225 (bisection), A000918 (bisection).

Programs

  • Haskell
    a075427 n = a075427_list !! n
    a075427_list = 1 : f 1 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
    [2^Floor((n+3)/2)-3/2+(-1)^n/2: n in [0..30]]; // Vincenzo Librandi, Aug 17 2011
    
  • Maple
    A075427 := proc(n) if type(n,'even') then 2^(n/2+1)-1 ; else 2^(1+(n+1)/2)-2 ; end if; end proc: seq(A075427(n), n=0..40); # R. J. Mathar, Feb 18 2011
    isA := proc(n) convert(n, base, 2): 1 - %[1] = nops(%) - add(%) end:
    select(isA, [$1..4095]); # Peter Luschny, Oct 27 2022
  • Mathematica
    a[0]=1; a[n_]:=a[n]=If[EvenQ[n],a[n-1]+1,2*a[n-1]]; Table[a[n],{n,0,40}] (* Jean-François Alcover, Mar 20 2011 *)
    nxt[{n_,a_}]:={n+1,If[OddQ[n],a+1,2a]}; Transpose[NestList[nxt,{0,1},40]][[2]] (* or *) LinearRecurrence[{0,3,0,-2},{1,2,3,6},50] (* Harvey P. Dale, Mar 12 2016 *)
  • PARI
    a(n)=2^((n+3)\2)-3/2+(-1)^n/2 \\ Charles R Greathouse IV, Feb 06 2017
    
  • Python
    def A075427(n): return (1<<(n>>1)+2)-2 if n&1 else (1<<(n>>1)+1)-1 # Chai Wah Wu, Apr 23 2023

Formula

a(0) = 1; for n >= 1, a(2*n) = 2^(n+1)-1, a(2*n-1) = 2^(n+1)-2; a(n) = 2^floor((n+3)/2) - 3/2 + (-1)^n/2. - Benoit Cloitre, Sep 17 2002 [corrected by Robert FERREOL, Jan 26 2011]
a(n) = (-1)^n/2 - 3/2 + 2^(n/2)*(1 + sqrt(2) + (1-sqrt(2))*(-1)^n). - Paul Barry, Apr 22 2004
From Paul Barry, Jul 30 2004: (Start)
Interleaved Mersenne numbers: interleaves 2*2^n-1 and 2(2*2^n-1) (A000225(n+1) and 2*A000225(n+1)).
G.f.: (1+2*x)/((1-x^2)*(1-2*x^2));
a(n) = 3*a(n-2) - 2*a(n-4);
a(n) = Sum_{k=0..n} binomial(floor((n+1)/2), floor((k+1)/2)). (End)
For n > 0: a(n) = (1 + n mod 2) * a(n-1) + 1 - (n mod 2). - Reinhard Zumkeller, Feb 27 2012
E.g.f.: 2*(cosh(sqrt(2)*x) - sinh(x) + sqrt(2)*sinh(sqrt(2)*x)) - cosh(x). - Stefano Spezia, Jul 11 2023
From Alois P. Heinz, Dec 27 2023: (Start)
a(n) = 2^floor((n+3)/2)-1-(n mod 2).
a(n) = A066880(n) for n>=1. (End)

Extensions

Formulae corrected and minor edits by Johannes W. Meijer, Aug 16 2011