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.

A058207 Three steps forward, two steps back.

This page as a plain text file.
%I A058207 #36 Feb 17 2022 00:50:29
%S A058207 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,
%T A058207 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,
%U A058207 13,12,13,14,15,14,13,14,15,16,15,14,15,16,17,16,15,16,17,18,17,16,17,18
%N A058207 Three steps forward, two steps back.
%H A058207 Reinhard Zumkeller, <a href="/A058207/b058207.txt">Table of n, a(n) for n = 0..10000</a>
%H A058207 <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (1,0,0,0,1,-1).
%F A058207 a(n) = a(n-5) + 1.
%F A058207 a(n) = a(n-1) + 1 if n=1, 2 or 3 mod 5.
%F A058207 a(n) = a(n-1) - 1 if n=0 or 4 mod 5.
%F A058207 G.f.: (x*(1+x+x^2-x^3-x^4))/((x-1)^2*(1+x+x^2+x^3+x^4)). [Corrected by _Georg Fischer_, May 18 2019]
%F A058207 a(n) = n/5 + 4/5*((n mod 5) mod 4) + (6/5)*floor((n mod 5)/4). - _Rolf Pleisch_, Jul 26 2009
%F A058207 a(n) = Sum_{i=1..n} (-1)^floor((2*i-2)/5). - _Wesley Ivan Hurt_, Oct 28 2015
%p A058207 A058207:=n->add((-1)^floor((2*i-2)/5), i=1..n): seq(A058207(n), n=0..100); # _Wesley Ivan Hurt_, Oct 28 2015
%t A058207 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_ *)
%t A058207 LinearRecurrence[{1,0,0,0,1,-1},{0,1,2,3,2,1},110] (* _Harvey P. Dale_, Feb 27 2013 *)
%o A058207 (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
%o A058207 (Haskell)
%o A058207 a058207 n = a058207_list !! n
%o A058207 a058207_list = f [0,1,2,3,2] where f xs = xs ++ f (map (+ 1) xs)
%o A058207 -- _Reinhard Zumkeller_, Jul 28 2011
%o A058207 (PARI) a(n)=n\5+[0,1,2,3,2][n%5+1] \\ _Charles R Greathouse IV_, Jul 28 2011
%Y A058207 Cf. A008611.
%K A058207 easy,nonn,nice
%O A058207 0,3
%A A058207 _Henry Bottomley_, Nov 29 2000
%E A058207 Second formula corrected by _Charles R Greathouse IV_, Jul 28 2011