This site is supported by donations to The OEIS Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A058207 Three steps forward, two steps back. 9
 0, 1, 2, 3, 2, 1, 2, 3, 4, 3, 2, 3, 4, 5, 4, 3, 4, 5, 6, 5, 4, 5, 6, 7, 6, 5, 6, 7, 8, 7, 6, 7, 8, 9, 8, 7, 8, 9, 10, 9, 8, 9, 10, 11, 10, 9, 10, 11, 12, 11, 10, 11, 12, 13, 12, 11, 12, 13, 14, 13, 12, 13, 14, 15, 14, 13, 14, 15, 16, 15, 14, 15, 16, 17, 16, 15, 16, 17, 18, 17, 16, 17, 18 (list; graph; refs; listen; history; text; internal format)
 OFFSET 0,3 LINKS Reinhard Zumkeller, Table of n, a(n) for n = 0..10000 Index entries for linear recurrences with constant coefficients, signature (1,0,0,0,1,-1). FORMULA a(n) = a(n-5) + 1. a(n) = a(n-1) + 1 if n=1, 2 or 3 mod 5. a(n) = a(n-1) - 1 if n=0 or 4 mod 5. G.f.: (x*(1+x^2)*(1+x)^2 + x^3)/(1-x^5)^2. a(n) = n/5 + 4/5*((n mod 5) mod 4) + (6/5)*floor((n mod 5)/4). - Rolf Pleisch, Jul 26 2009 a(n) = Sum_{i=1..n} (-1)^floor((2*i-2)/5). - Wesley Ivan Hurt, Oct 28 2015 MAPLE A058207:=n->add((-1)^floor((2*i-2)/5), i=1..n): seq(A058207(n), n=0..100); # Wesley Ivan Hurt, Oct 28 2015 MATHEMATICA a[n_] := Quotient[n, 5] + {0, 1, 2, 3, 2}[[Mod[n, 5] + 1]]; Table[a[n], {n, 0, 82}] (* Jean-François Alcover, Dec 12 2011, after Charles R Greathouse IV *) LinearRecurrence[{1, 0, 0, 0, 1, -1}, {0, 1, 2, 3, 2, 1}, 110] (* Harvey P. Dale, Feb 27 2013 *) PROG (MAGMA) [ n le 4 select n-1 else n eq 5 select 2 else Self(n-5)+1: n in [1..83] ]; // Klaus Brockhaus, Apr 14 2009 (Haskell) a058207 n = a058207_list !! n a058207_list = f [0, 1, 2, 3, 2] where f xs = xs ++ f (map (+ 1) xs) -- Reinhard Zumkeller, Jul 28 2011 (PARI) a(n)=n\5+[0, 1, 2, 3, 2][n%5+1] \\ Charles R Greathouse IV, Jul 28 2011 CROSSREFS Cf. A008611. Sequence in context: A152978 A118121 A006968 * A105969 A275892 A163530 Adjacent sequences:  A058204 A058205 A058206 * A058208 A058209 A058210 KEYWORD easy,nonn,nice AUTHOR Henry Bottomley, Nov 29 2000 EXTENSIONS Second formula corrected by Charles R Greathouse IV, Jul 28 2011 STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified March 21 10:00 EDT 2019. Contains 321368 sequences. (Running on oeis4.)