This site is supported by donations to The OEIS Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A158289 Period 18 zigzag sequence: repeat [0,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1]. 14
 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5 (list; graph; refs; listen; history; text; internal format)
 OFFSET 0,3 COMMENTS A toothed or zigzag sequence. Sequence contains only numbers 0..9; abs(a(n+1)-a(n)) = 1. LINKS Arkadiusz Wesolowski, Table of n, a(n) for n = 0..10000 FORMULA a(18*k+j) = a(18*(k+1)-j) = j for k >= 0, j = 0..9. G.f.: x*(1+x+x^2)*(1+x^3+x^6)/((1-x)*(1+x)*(1-x+x^2)*(1-x^3+x^6)). - Klaus Brockhaus, Sep 07 2009 a(n) = (1/153)*{13*(n mod 18)+13*[(n+1) mod 18]+13*[(n+2) mod 18]+13*[(n+3) mod 18]+13*[(n+4) mod 18]+13*[(n+5) mod 18]+13*[(n+6) mod 18]+13*[(n+7) mod 18]+13*[(n+8) mod 18]-4*[(n+9) mod 18]-4*[(n+10) mod 18]-4*[(n+11) mod 18]-4*[(n+12) mod 18]-4*[(n+13) mod 18]-4*[(n+14) mod 18]-4*[(n+15) mod 18]-4*[(n+16) mod 18]-4*[(n+17) mod 18]}, with n>=0. - Paolo P. Lava, Nov 12 2009 a(n) = Sum_{i=0..n-1} (-1)^floor(i/9). - Wesley Ivan Hurt, Jul 25 2015 a(n) = abs(n - 18*round(n/18)). - Wesley Ivan Hurt, Dec 10 2016 MATHEMATICA a[n_] := If[m = Mod[n, 18]; m <= 9, m, 18-m]; Table[a[n], {n, 0, 85}] (* Jean-François Alcover, Jul 19 2013 *) PadRight[{}, 100, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1}] (* Vincenzo Librandi, Jul 26 2015 *) PROG (MAGMA) [ s lt 9 select r else 9-r where r is n mod 9 where s is n mod 18: n in [0..104] ]; // Klaus Brockhaus, Sep 07 2009 (MAGMA) S:=[]; a:=0; for n in [0..104] do Append(~S, a); if n mod 18 eq 0 then d:=1; else if n mod 9 eq 0 then d:=-1; end if; end if; a+:=d; end for; S; // Klaus Brockhaus, Sep 07 2009 (MAGMA) &cat[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1]: n in [0..5]]; // Vincenzo Librandi, Jul 26 2015 (PARI) a(n)=abs(n-round(n/18)*18) \\ M. F. Hasler, Jul 27 2015 CROSSREFS Cf. A068073 (repeat 1,2,3,2), A028356 (repeat 1,2,3,4,3,2), A130784 (repeat 1,3,2). Period k zigzag sequences: A000035 (k=2), A007877 (k=4), A260686 (k=6), A266313 (k=8), A271751 (k=10), A271832 (k=12), A279313 (k=14), A279319 (k=16), this sequence (k=18). Sequence in context: A028902 A081598 A232360 * A213652 A262734 A287794 Adjacent sequences:  A158286 A158287 A158288 * A158290 A158291 A158292 KEYWORD easy,nonn AUTHOR Jaroslav Krizek, Mar 15 2009 EXTENSIONS Edited and extended by Klaus Brockhaus, Sep 07 2009 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 October 15 15:14 EDT 2019. Contains 328030 sequences. (Running on oeis4.)