login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A084964
Follow n+2 by n. Also solution of a(n+2)=a(n)+1, a(0)=2, a(1)=0.
28
2, 0, 3, 1, 4, 2, 5, 3, 6, 4, 7, 5, 8, 6, 9, 7, 10, 8, 11, 9, 12, 10, 13, 11, 14, 12, 15, 13, 16, 14, 17, 15, 18, 16, 19, 17, 20, 18, 21, 19, 22, 20, 23, 21, 24, 22, 25, 23, 26, 24, 27, 25, 28, 26, 29, 27, 30, 28, 31, 29, 32, 30, 33, 31, 34, 32, 35, 33, 36, 34, 37, 35, 38, 36, 39
OFFSET
0,1
FORMULA
G.f.: (2-2x+x^2)/((1-x)(1-x^2)).
a(2n+1)=n. a(2n)=n+2. a(n+2)=a(n)+1. a(n)=-a(-3-n).
a(n) = floor(n/2) + 1 + (-1)^n. - Reinhard Zumkeller, Aug 27 2005
A112032(n)=2^a(n); A112033(n)=3*2^a(n); a(n)=A109613(n+2)-A052938(n). - Reinhard Zumkeller, Aug 27 2005
a(n) = n + 1 - a(n-1) (with a(0)=2). - Vincenzo Librandi, Aug 08 2010
a(n) = floor(n/2)*3 - floor((n-1)/2)*2. - Ross La Haye, Mar 27 2013
a(n) = 3*n - 3 - 5*floor((n-1)/2). - Wesley Ivan Hurt, Nov 08 2013
a(n) = (3 + 5*(-1)^n + 2*n)/4. - Wolfgang Hintze, Dec 13 2014
E.g.f.: ((4 + x)*cosh(x) - (1 - x)*sinh(x))/2. - Stefano Spezia, Jul 01 2023
MAPLE
A084964:=n->floor(n/2)+1+(-1)^n; seq(A084964(k), k=0..100); # Wesley Ivan Hurt, Nov 08 2013
MATHEMATICA
lst={}; a=1; Do[a=n-a; AppendTo[lst, a], {n, 0, 100}]; lst (* Vladimir Joseph Stephan Orlovsky, Dec 14 2008 *)
Table[{n, n-2}, {n, 2, 40}]//Flatten (* or *) LinearRecurrence[{1, 1, -1}, {2, 0, 3}, 80] (* Harvey P. Dale, Sep 12 2021 *)
PROG
(PARI) a(n)=n\2-2*(n%2)+2
(Magma) &cat[ [n+2, n]: n in [0..37] ]; [Klaus Brockhaus, Nov 23 2009]
(Haskell)
import Data.List (transpose)
a084964 n = a084964_list !! n
a084964_list = concat $ transpose [[2..], [0..]]
-- Reinhard Zumkeller, Apr 06 2015
CROSSREFS
Cf. A217764(1,n) = a(n+2).
Sequence in context: A331478 A378500 A097065 * A267182 A008720 A340622
KEYWORD
nonn,easy
AUTHOR
Michael Somos, Jun 15 2003
EXTENSIONS
First part of definition adjusted to match offset by Klaus Brockhaus, Nov 23 2009
STATUS
approved