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).

This page as a plain text file.
%I A075427 #96 Dec 27 2023 20:44:12
%S A075427 1,2,3,6,7,14,15,30,31,62,63,126,127,254,255,510,511,1022,1023,2046,
%T A075427 2047,4094,4095,8190,8191,16382,16383,32766,32767,65534,65535,131070,
%U A075427 131071,262142,262143,524286,524287,1048574,1048575,2097150,2097151,4194302,4194303,8388606
%N A075427 a(0) = 1; a(n) = a(n-1)+1 if n is even, otherwise a(n) = 2*a(n-1).
%C A075427 Fixed points for permutations A180200, A180201, A180198, and A180199. - _Reinhard Zumkeller_, Aug 15 2010
%C A075427 The Kn22 sums, see A180662, of triangle A194005 equal the terms of this sequence. - _Johannes W. Meijer_, Aug 16 2011
%H A075427 Vincenzo Librandi, <a href="/A075427/b075427.txt">Table of n, a(n) for n = 0..2000</a>
%H A075427 R. Hinze, <a href="https://www.cs.ox.ac.uk/people/ralf.hinze/publications/CSC.pdf">Concrete stream calculus: An extended study</a>, J. Funct. Progr. 20 (5-6) (2010) 463-535, <a href="https://doi.org/10.1017/S0956796810000213">doi</a>.
%H A075427 <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (0,3,0,-2).
%F A075427 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]
%F A075427 a(n) = (-1)^n/2 - 3/2 + 2^(n/2)*(1 + sqrt(2) + (1-sqrt(2))*(-1)^n). - _Paul Barry_, Apr 22 2004
%F A075427 From _Paul Barry_, Jul 30 2004: (Start)
%F A075427 Interleaved Mersenne numbers: interleaves 2*2^n-1 and 2(2*2^n-1) (A000225(n+1) and 2*A000225(n+1)).
%F A075427 G.f.: (1+2*x)/((1-x^2)*(1-2*x^2));
%F A075427 a(n) = 3*a(n-2) - 2*a(n-4);
%F A075427 a(n) = Sum_{k=0..n} binomial(floor((n+1)/2), floor((k+1)/2)). (End)
%F A075427 For n > 0: a(n) = (1 + n mod 2) * a(n-1) + 1 - (n mod 2). - _Reinhard Zumkeller_, Feb 27 2012
%F A075427 E.g.f.: 2*(cosh(sqrt(2)*x) - sinh(x) + sqrt(2)*sinh(sqrt(2)*x)) - cosh(x). - _Stefano Spezia_, Jul 11 2023
%F A075427 From _Alois P. Heinz_, Dec 27 2023: (Start)
%F A075427 a(n) = 2^floor((n+3)/2)-1-(n mod 2).
%F A075427 a(n) = A066880(n) for n>=1. (End)
%p A075427 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
%p A075427 isA := proc(n) convert(n, base, 2): 1 - %[1] = nops(%) - add(%) end:
%p A075427 select(isA, [$1..4095]); # _Peter Luschny_, Oct 27 2022
%t A075427 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 *)
%t A075427 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 *)
%o A075427 (Magma) [2^Floor((n+3)/2)-3/2+(-1)^n/2: n in [0..30]]; // _Vincenzo Librandi_, Aug 17 2011
%o A075427 (Haskell)
%o A075427 a075427 n = a075427_list !! n
%o A075427 a075427_list = 1 : f 1 1 where
%o A075427    f x y = z : f (x + 1) z where z = (1 + x `mod` 2) * y + 1 - x `mod` 2
%o A075427 -- _Reinhard Zumkeller_, Feb 27 2012
%o A075427 (PARI) a(n)=2^((n+3)\2)-3/2+(-1)^n/2 \\ _Charles R Greathouse IV_, Feb 06 2017
%o A075427 (Python)
%o A075427 def A075427(n): return (1<<(n>>1)+2)-2 if n&1 else (1<<(n>>1)+1)-1 # _Chai Wah Wu_, Apr 23 2023
%Y A075427 Cf. A075426, A066880, A083416, A000225 (bisection), A000918 (bisection).
%Y A075427 Cf. A180198, A180199, A180200, A180201, A180662, A194005.
%K A075427 nonn,nice,easy
%O A075427 0,2
%A A075427 _Reinhard Zumkeller_, Sep 15 2002
%E A075427 Formulae corrected and minor edits by _Johannes W. Meijer_, Aug 16 2011