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.

Showing 1-10 of 11 results. Next

A000035 Period 2: repeat [0, 1]; a(n) = n mod 2; parity of n.

Original entry on oeis.org

0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0
Offset: 0

Views

Author

Keywords

Comments

Least significant bit of n, lsb(n).
Also decimal expansion of 1/99.
Also the binary expansion of 1/3. - Robert G. Wilson v, Sep 01 2015
a(n) = A134451(n) mod 2. - Reinhard Zumkeller, Oct 27 2007 [Corrected by Jianing Song, Nov 22 2019]
Characteristic function of odd numbers: a(A005408(n)) = 1, a(A005843(n)) = 0. - Reinhard Zumkeller, Sep 29 2008
A102370(n) modulo 2. - Philippe Deléham, Apr 04 2009
Base b expansion of 1/(b^2-1) for any b >= 2 is 0.0101... (A005563 has b^2-1). - Rick L. Shepherd, Sep 27 2009
Let A be the Hessenberg n X n matrix defined by: A[1,j] = j mod 2, A[i,i] := 1, A[i,i-1] = -1, and A[i,j] = 0 otherwise. Then, for n >= 1, a(n) = (-1)^n*charpoly(A,1). - Milan Janjic, Jan 24 2010
From R. J. Mathar, Jul 15 2010: (Start)
The sequence is the principal Dirichlet character of the reduced residue system mod 2 or mod 4 or mod 8 or mod 16 ...
Associated Dirichlet L-functions are for example L(2,chi) = Sum_{n>=1} a(n)/n^2 == A111003,
or L(3,chi) = Sum_{n>=1} a(n)/n^3 = 1.05179979... = 7*A002117/8,
or L(4,chi) = Sum_{n>=1} a(n)/n^4 = 1.014678... = A092425/96. (End)
Also parity of the nonnegative integers A001477. - Omar E. Pol, Jan 17 2012
a(n) = (4/n), where (k/n) is the Kronecker symbol. See the Eric Weisstein link. - Wolfdieter Lang, May 28 2013
Also the inverse binomial transform of A131577. - Paul Curtz, Nov 16 2016 [an observation forwarded by Jean-François Alcover]
The emanation sequence for the globe category. That is take the globe category, take the corresponding polynomial comonad, consider its carrier polynomial as a generating function, and take the corresponding sequence. - David Spivak, Sep 25 2020
For n > 0, a(n) is the alternating sum of the product of n increasing and n decreasing odd factors. For example, a(4) = 1*7 - 3*5 + 5*3 - 7*1 and a(5) = 1*9 - 3*7 + 5*5 - 7*3 + 9*1. - Charlie Marion, Mar 24 2022

Examples

			G.f. = x + x^3 + x^5 + x^7 + x^9 + x^11 + x^13 + x^15 + ... - _Michael Somos_, Feb 20 2024
		

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Ones complement of A059841.
Cf. A053644 for most significant bit.
This is Guy Steele's sequence GS(1, 2) (see A135416).
Period k zigzag sequences: this sequence (k=2), A007877 (k=4), A260686 (k=6), A266313 (k=8), A271751 (k=10), A271832 (k=12), A279313 (k=14), A279319 (k=16), A158289 (k=18).
Cf. A154955 (Mobius transform), A131577 (binomial transform).
Cf. A111003 (Dgf at s=2), A233091 (Dgf at s=3), A300707 (Dgf at s=4).
Parity of A005811.

Programs

Formula

a(n) = (1 - (-1)^n)/2.
a(n) = n mod 2.
a(n) = 1 - a(n-1).
Multiplicative with a(p^e) = p mod 2. - David W. Wilson, Aug 01 2001
G.f.: x/(1-x^2). E.g.f.: sinh(x). - Paul Barry, Mar 11 2003
a(n) = (A000051(n) - A014551(n))/2. - Mario Catalani (mario.catalani(AT)unito.it), Aug 30 2003
a(n) = ceiling((-2)^(-n-1)). - Reinhard Zumkeller, Apr 19 2005
Dirichlet g.f.: (1-1/2^s)*zeta(s). - R. J. Mathar, Mar 04 2011
a(n) = ceiling(n/2) - floor(n/2). - Arkadiusz Wesolowski, Sep 16 2012
a(n) = ceiling( cos(Pi*(n-1))/2 ). - Wesley Ivan Hurt, Jun 16 2013
a(n) = floor((n-1)/2) - floor((n-2)/2). - Mikael Aaltonen, Feb 26 2015
Dirichlet g.f.: L(chi(2),s) with chi(2) the principal Dirichlet character modulo 2. - Ralf Stephan, Mar 27 2015
a(n) = 0^^n = 0^(0^(0...)) (n times), where we take 0^0 to be 1. - Natan Arie Consigli, May 02 2015
Euler transform and inverse Moebius transform of length 2 sequence [0, 1]. - Michael Somos, Feb 20 2024

A007877 Period 4 zigzag sequence: repeat [0,1,2,1].

Original entry on oeis.org

0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0
Offset: 0

Views

Author

Christopher Lam Cham Kee (Topher(AT)CyberDude.Com)

Keywords

Comments

Euler transform of finite sequence [2,-2,0,1]. - Michael Somos, Sep 17 2004
This is the r = 2 member in the r-family of sequences S_r(n) defined in A092184 where more information can be found.
a(n+1) is the transform of sqrt(1+2x)/sqrt(1-2x) (A063886) under the Chebyshev transformation A(x) -> (1/(1 + x^2))A(x/(1 + x^2)). See also A084099. - Paul Barry, Oct 12 2004
Multiplicative with a(2) = 2, a(2^e) = 0 if e >= 2, a(p^e) = 1 otherwise. - David W. Wilson, Jun 12 2005
The e.g.f. of 1, 2, 1, 0, 1, 2, 1, 0, ... (shifted left, offset zero) is exp(x) + sin(x).
Binomial transform is A000749(n+2). - Wesley Ivan Hurt, Dec 30 2015
Decimal expansion of 11/909. - David A. Corneth, Dec 12 2016
Ternary expansion of 1/5. - J. Conrad, Aug 14 2017

Crossrefs

Period k zigzag sequences: A000035 (k=2), this sequence (k=4), A260686 (k=6), A266313 (k=8), A271751 (k=10), A271832 (k=12), A279313 (k=14), A279319 (k=16), A158289 (k=18).

Programs

  • Magma
    &cat [[0,1,2,1]^^25]; // Vincenzo Librandi, Dec 27 2015
    
  • Maple
    A007877:=n->sqrt(n^2 mod 8); seq(A007877(n), n=0..100); # Wesley Ivan Hurt, Jan 01 2014
  • Mathematica
    f[n_] := Mod[n, 4] - Mod[n^3, 4] + Mod[n^2, 4] (* Or *)
    f[n_] := Mod[n, 2] + 2 Floor[Mod[n + 1, 4]/3] (* Or *)
    f[n_] := Switch[Mod[n, 4], 0, 0, 1, 1, 2, 2, 3, 1]; Array[f, 105, 0] (* Robert G. Wilson v, Aug 08 2011 *)
    Table[Sqrt[Mod[n^2,8]], {n,0,100}] (* Wesley Ivan Hurt, Jan 01 2014 *)
    LinearRecurrence[{1, -1, 1}, {0, 1, 2}, 80] (* Vincenzo Librandi, Dec 27 2015 *)
    PadRight[{},100,{0,1,2,1}] (* Harvey P. Dale, Oct 24 2023 *)
  • PARI
    a(n)=[0,1,2,1][1+n%4] \\ Jaume Oliver Lafont, Mar 27 2009
    
  • PARI
    concat(0, Vec(x*(1+x)/(1-x+x^2-x^3) + O(x^100))) \\ Altug Alkan, Dec 29 2015
    
  • Python
    def A007877(n): return (0,1,2,1)[n&3] # Chai Wah Wu, Jan 26 2023

Formula

Multiplicative with a(p^e) = 2 if p = 2 and e = 0; 0 if p = 2 and e > 0; 1 if p > 2. - David W. Wilson, Aug 01 2001
a(n) = -Sum_{k=0..n} (-1)^C(k+2, 2) (Offset -1). - Paul Barry, Jul 07 2003
a(n) = 1 - cos(n*Pi/2); a(n) = a(n-1) - a(n-2) + a(n-3) for n>2. - Lee Reeves (leereeves(AT)fastmail.fm), May 10 2004
a(n) = -a(n-2) + 2, n >= 2, a(0) = 0, a(1) = 1.
G.f.: x*(1+x)/((1-x)*(1+x^2)) = x*(1+x)/(1-x+x^2-x^3).
a(n) = 1 - T(n, 0) = 1 - A056594(n) with Chebyshev's polynomials T(n, x) of the first kind. Note that T(n, 0) = S(n, 0).
a(n) = b(n) + b(n-1), n >= 1, with b(n) := A021913(n+1) the partial sums of S(n,0) = U(n,0) = A056594(n) (Chebyshev's polynomials evaluated at x=0).
a(n) = 1 + (1/2){(-1)^[(n-1)/2] - (-1)^[n/2]}. - Ralf Stephan, Jun 09 2005
Non-reduced g.f.: x*(1+x)^2/(1-x^4). - Jaume Oliver Lafont, Mar 27 2009
a(n+1) = (S(n, sqrt(2)))^2, n >= 0, with the Chebyshev S-polynomials A049310. See the W. Lang link under A181878. - Wolfdieter Lang, Dec 15 2010
Dirichlet g.f. (1 + 1/2^s - 2/4^s)*zeta(s). - R. J. Mathar, Feb 24 2011
a(n) = (n mod 4) - (n^3 mod 4) + (n^2 mod 4). - Gary Detlefs, Apr 17 2011
a(n) = (n mod 2) + 2*floor(((n+1) mod 4)/3). - Gary Detlefs, Jul 19 2011
a(n) = sqrt(n^2 mod 8). - Wesley Ivan Hurt, Jan 01 2014
a(n) = (n AND 4*k+2)-(n AND 4*k+1) + 2*floor(((n+2) mod 4)/3), for any k. - Gary Detlefs, Jun 08 2014
a(n) = Sum_{i=1..n} (-1)^floor((i-1)/2). - Wesley Ivan Hurt, Dec 26 2015
a(n) = a(n-4) for n >= 4. - Wesley Ivan Hurt, Sep 07 2022
a(n) = n - 2*floor(n/4) - 2*floor((n+1)/4). - Ridouane Oudra, Jan 22 2024
E.g.f.: exp(x) - cos(x). - Stefano Spezia, Aug 04 2025

Extensions

Chebyshev comments from Wolfdieter Lang, Sep 10 2004

A158289 Period 18 zigzag sequence: repeat [0,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1].

Original entry on oeis.org

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
Offset: 0

Views

Author

Jaroslav Krizek, Mar 15 2009

Keywords

Comments

A toothed or zigzag sequence.
Sequence contains only numbers 0..9; abs(a(n+1)-a(n)) = 1.
Decimal expansion of 12345679/1000000001. - Elmo R. Oliveira, Feb 20 2024

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

Programs

  • 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
    
  • 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 *)
  • PARI
    a(n)=abs(n-round(n/18)*18) \\ M. F. Hasler, Jul 27 2015

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) = 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
a(n) = a(n-18) for n >= 18. - Wesley Ivan Hurt, Sep 07 2022

Extensions

Edited and extended by Klaus Brockhaus, Sep 07 2009

A260686 Period 6 zigzag sequence, repeat [0, 1, 2, 3, 2, 1].

Original entry on oeis.org

0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1
Offset: 0

Views

Author

Wesley Ivan Hurt, Nov 15 2015

Keywords

Comments

Decimal expansion of 37/3003. - Elmo R. Oliveira, Mar 06 2024

Crossrefs

Period k zigzag sequences: A000035 (k=2), A007877 (k=4), this sequence (k=6), A266313 (k=8), A271751 (k=10), A271832 (k=12), A279313 (k=14), A279319 (k=16), A158289 (k=18).

Programs

  • Magma
    [1+(1-(-1)^n)/2-(-1)^Floor((n+1)/3): n in [0..100]]; // Bruno Berselli, Nov 16 2015
    
  • Magma
    &cat[[0,1,2,3,2,1]: n in [0..15]]; // Vincenzo Librandi, Nov 17 2015
  • Maple
    A260686:=n->[0, 1, 2, 3, 2, 1][(n mod 6)+1]: seq(A260686(n), n=0..100);
  • Mathematica
    CoefficientList[Series[(x + x^2 + x^3)/(1 - x + x^3 - x^4), {x, 0, 100}], x]
    Table[1 + (1 - (-1)^n)/2 - (-1)^Floor[(n + 1)/3], {n, 0, 100}] (* Bruno Berselli, Nov 16 2015 *)
    PadRight[{}, 120, {0, 1, 2, 3, 2, 1}] (* Vincenzo Librandi, Nov 17 2015 *)
  • PARI
    concat(0, Vec((x+x^2+x^3)/(1-x+x^3-x^4) + O(x^100))) \\ Altug Alkan, Nov 15 2015
    

Formula

G.f.: x*(1 + x + x^2) / (1 - x + x^3 - x^4).
a(n) = a(n-1) - a(n-3) + a(n-4) for n > 3.
a(n) = Sum_{i=1..n} (-1)^floor((i-1)/3) for n > 0.
a(n+1) = a(n) + A130151(n).
a(2n) = 2*A011655(n), a(2n+1) = A109007(n+2).
a(n) = 1 + (1 - (-1)^n)/2 - (-1)^floor((n+1)/3). - Bruno Berselli, Nov 16 2015
a(n) = sin(n*Pi/6)^2*(11+4*cos(n*Pi/3)+2*cos(2*n*Pi/3))/3. - Wesley Ivan Hurt, Jun 17 2016
a(n) = a(n-6) for n >= 6. - Wesley Ivan Hurt, Sep 07 2022
a(n) = sqrt(n^2 mod 12) = sqrt(A070435(n)). - Nicolas Bělohoubek, May 24 2024

A053616 Pyramidal sequence: distance to nearest triangular number.

Original entry on oeis.org

0, 0, 1, 0, 1, 1, 0, 1, 2, 1, 0, 1, 2, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 4, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1
Offset: 0

Views

Author

Henry Bottomley, Mar 20 2000

Keywords

Comments

From Wolfdieter Lang, Oct 24 2020: (Start)
If this sequence is written with offset 1 as a number triangle T(n, k), with n the length of row n, for n >= 1, then row n gives the primitive period of the periodic sequence {k (mod* n)}_{k>=0}, where k (mod* n) = k (mod n) if k <= floor(n/2) and otherwise it is -k (mod n). Such a modified modular relation mod* n has been used by Brändli and Beyne, but for integers relative prime to n.
These periodic sequences are given in A000007, A000035, A011655, A007877, |A117444|, A260686, A279316, for n = 1, 2, ..., 7. For n = 10 A271751, n = 12 A271832, n = 14 A279313. (End)

Examples

			a(12) = |12 - 10| = 2 since 10 is the nearest triangular number to 12.
From _M. F. Hasler_, Dec 06 2019: (Start)
Ignoring a(0) = 0, the sequence can be written as triangle indexed by m >= k >= 1, in which case the terms are (m - |k - |m-k||)/2, as follows:
   0,      (Row 0: ignore)
   0,      (Row m=1, k=1: For k=m, m - |k - |m-k|| = m - |m - 0| = 0.)
   1, 0,        (Row m=2: for k=1, |m-k| = 1, k-|m-k| = 0, m-0 = 2, (...)/2 = 1.)
   1, 1, 0,
   1, 2, 1, 0,    (Row m=4: for k=2, we have twice the value of (m=2, k=1) => 2.)
   1, 2, 2, 1, 0,
   (...)
This is related to the non-associative operation A049581(x,y) = |x - y| =: x @ y. Specifically, @ is commutative and any x is its own inverse, so non-associativity of @ can be measured through the commutator ((x @ y) @ y) @ x which equals twice the element indexed {m,k} = {x,y} in the above triangle.
(End)
		

Crossrefs

a(n) = abs(A305258(n)).

Programs

  • Mathematica
    a[n_] := (k =.; k = Reduce[k > 0 && k*(k+1)/2 == n, Reals][[2]] // Floor; Min[(k+1)*(k+2)/2 - n, n - k*(k+1)/2]); Table[a[n], {n, 0, 104}] (* Jean-François Alcover, Jan 08 2013 *)
    Module[{trms=120,t},t=Accumulate[Range[Ceiling[(Sqrt[8*trms+1]-1)/2]]]; Join[{0},Flatten[Table[Abs[Nearest[t,n][[1]]-n],{n,trms}]]]] (* Harvey P. Dale, Nov 08 2013 *)
  • PARI
    print1(x=0, ", ");for(stride=1,13,x+=stride;y=x+stride+1;for(k=x,y-1,print1(min(k-x,y-k), ", "))) \\ Hugo Pfoertner, Jun 02 2018
    
  • PARI
    apply( {a(n)=if(n,-abs(n*2-(n=sqrtint(8*n-7)\/2)^2)+n)\2}, [0..40]) \\ same as (i - |j - |i-j||)/2 with i=sqrtint(8*n-7)\/2, j=n-i(i-1)/2. - M. F. Hasler, Dec 06 2019
    
  • Python
    from math import isqrt
    def A053616(n): return abs((m:=isqrt(k:=n<<1))*(m+1)-k)>>1 # Chai Wah Wu, Jul 15 2022

Formula

a(n) = (x - |y - |x-y||)/2, when (x,y) is the n-th element in the triangle x >= y >= 1. - M. F. Hasler, Dec 06 2019
a(n) = (1/2)*abs(t^2 + t - 2*n), where t = floor(sqrt(2*n)) = A172471. - Ridouane Oudra, Dec 15 2021
From Ctibor O. Zizka, Nov 12 2024: (Start)
For s >= 1, t from [0, s] :
a(2*s^2 + t) = s - t.
a(2*s^2 - t) = s - t.
a(2*s^2 + 2*s - t) = s - t.
a(2*s^2 + 2*s + 1 + t) = s - t. (End)

A271751 Period 10 zigzag sequence; repeat: [0, 1, 2, 3, 4, 5, 4, 3, 2, 1].

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5
Offset: 0

Views

Author

Wesley Ivan Hurt, Apr 13 2016

Keywords

Comments

Decimal expansion of 11111/900009. - Elmo R. Oliveira, Mar 03 2024

Crossrefs

Period k zigzag sequences: A000035 (k=2), A007877 (k=4), A260686 (k=6), A266313 (k=8), this sequence (k=10), A271832 (k=12), A279313 (k=14), A279319 (k=16), A158289 (k=18).

Programs

  • Magma
    &cat[[0, 1, 2, 3, 4, 5, 4, 3, 2, 1]: n in [0..10]];
    
  • Maple
    a:=n->[0, 1, 2, 3, 4, 5, 4, 3, 2, 1][(n mod 10)+1]: seq(a(n), n=0..100);
  • Mathematica
    CoefficientList[Series[x*(1 + x + x^2 + x^3 + x^4)/(1 - x + x^5 - x^6), {x, 0, 30}], x]
  • PARI
    a(n) = abs(n-10*round(n/10)); \\ Altug Alkan, Apr 13 2016

Formula

G.f.: x*(1 + x + x^2 + x^3 + x^4)/(1 - x + x^5 - x^6).
a(n) = a(n-1) - a(n-5) + a(n-6) for n>5.
a(n) = abs(n - 10*round(n/10)).
a(n) = Sum_{i=1..n} (-1)^floor((i-1)/5).
a(2n) = 2*abs(A117444(n)).
a(2n+7) = 2*A076839(n)-1 for n>0.
a(n) = a(n-10) for n >= 10. - Wesley Ivan Hurt, Sep 07 2022

A271832 Period 12 zigzag sequence: repeat [0,1,2,3,4,5,6,5,4,3,2,1].

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0, 1
Offset: 0

Views

Author

Wesley Ivan Hurt, Apr 15 2016

Keywords

Comments

a(n)/36 is the probability that the sum shown after rolling a pair of standard dice is 1+(n mod 12). - Mathew Englander, Jul 11 2022
Decimal expansion of 37037/3000003. - Elmo R. Oliveira, Mar 03 2024

Crossrefs

Period k zigzag sequences: A000035 (k=2), A007877 (k=4), A260686 (k=6), A266313 (k=8), A271751 (k=10), this sequence (k=12), A279313 (k=14), A279319 (k=16), A158289 (k=18).

Programs

  • Magma
    &cat[[0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1]: n in [0..10]];
    
  • Maple
    A271832:=n->[0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1][(n mod 12)+1]: seq(A271832(n), n=0..300);
  • Mathematica
    CoefficientList[Series[x*(1 + x + x^2 + x^3 + x^4 + x^5)/(1 - x + x^6 - x^7), {x, 0, 100}], x]
  • PARI
    lista(nn) = for(n=0, nn, print1(abs(n-12*round(n/12)), ", ")); \\ Altug Alkan, Apr 15 2016

Formula

G.f.: x*(1 + x + x^2 + x^3 + x^4 + x^5)/(1 - x + x^6 - x^7).
a(n) = a(n-1) - a(n-6) + a(n-7) for n>6.
a(n) = abs(n - 12*round(n/12)).
a(n) = Sum_{i=1..n} (-1)^floor((i-1)/6).
a(2n) = a(10n) = 2*A260686(n), a(2n+1) = A110551(n).
a(3n) = 3*A007877(n), a(4n) = a(8n) = 4*A011655(n).
a(6n) = A010677(n) = 6*A000035(n).
a(n) = a(n-12) for n >= 12. - Wesley Ivan Hurt, Sep 07 2022

A266313 Period 8 zigzag sequence; repeat [0, 1, 2, 3, 4, 3, 2, 1].

Original entry on oeis.org

0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 4, 3
Offset: 0

Views

Author

Wesley Ivan Hurt, Dec 26 2015

Keywords

Comments

Decimal expansion of 1111/90009. - Elmo R. Oliveira, Mar 03 2024

Examples

			G.f. = x + 2*x^2 + 3*x^3 + 4*x^4 + 3*x^5 + 2*x^6 + x^7 + x^9 + ... - _Michael Somos_, Feb 27 2020
		

Crossrefs

Period k zigzag sequences: A000035 (k=2), A007877 (k=4), A260686 (k=6), this sequence (k=8), A271751 (k=10), A271832 (k=12), A279313 (k=14), A279319 (k=16), A158289 (k=18).
Cf. A084101.

Programs

  • Magma
    &cat[[0, 1, 2, 3, 4, 3, 2, 1]: n in [0..10]];
    
  • Maple
    A266313:=n->[0, 1, 2, 3, 4, 3, 2, 1][(n mod 8)+1]: seq(A266313(n), n=0..100);
  • Mathematica
    CoefficientList[Series[x*(1 + x + x^2 + x^3)/(1 - x + x^4 - x^5), {x, 0, 100}], x]
  • PARI
    x='x+O('x^100); concat(0, Vec(x*(1+x+x^2+x^3)/(1-x+x^4-x^5))) \\ Altug Alkan, Dec 29 2015
    
  • PARI
    {a(n) = abs((n+4)\8*8-n)}; /* Michael Somos, Feb 27 2020 */

Formula

G.f.: x*(1+x+x^2+x^3)/(1-x+x^4-x^5).
a(n) = a(n-1) - a(n-4) + a(n-5) for n > 4.
a(n) = Sum_{i = 1..n} (-1)^floor((i-1)/4).
a(2n) = 2*A007877(n); a(2n+1) = A084101(n).
a(n) = abs(n - 8*round(n/8)). - Jon E. Schoenfield, Jan 01 2016
Euler transform of length 8 sequence [2, 0, 0, -2, 0, 0, 0, 1]. - Michael Somos, Feb 27 2020
a(n) = a(n-8) for n >= 8. - Wesley Ivan Hurt, Sep 07 2022

A279319 Period 16 zigzag sequence: repeat [0,1,2,3,4,5,6,7,8,7,6,5,4,3,2,1].

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5
Offset: 0

Views

Author

Wesley Ivan Hurt, Dec 09 2016

Keywords

Comments

Decimal expansion of 11111111/900000009. - Elmo R. Oliveira, Feb 20 2024

Crossrefs

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), this sequence (k=16), A158289 (k=18).

Programs

  • Magma
    &cat[[0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1]: n in [0..5]];
    
  • Mathematica
    PadRight[{}, 120, {0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1}] (* Vincenzo Librandi, Dec 10 2016 *)
    With[{k = 16}, Table[Min[Abs[# - k], #] &@ Mod[n, k], {n, 0, 120}]] (* or *)
    CoefficientList[Series[x (1 + x) (1 + x^2) (1 + x^4)/((1 - x) (1 + x^8)), {x, 0, 120}], x] (* Michael De Vlieger, Dec 10 2016 *)
  • Python
    def A279319(n): return (0,1,2,3,4,5,6,7,8,7,6,5,4,3,2,1)[n&15] # Chai Wah Wu, Mar 02 2023

Formula

a(n) = abs(n - 16*round(n/16)).
G.f.: x*(1 + x)*(1 + x^2)*(1 + x^4)/((1 - x)*(1 + x^8)). - Ilya Gutkovskiy, Dec 10 2016
a(n) = a(n-1)-a(n-8)+a(n-9). - Wesley Ivan Hurt, Nov 18 2021
a(n) = a(n-16) for n >= 16. - Wesley Ivan Hurt, Sep 07 2022

A279316 Period 7: repeat [0, 1, 2, 3, 3, 2, 1].

Original entry on oeis.org

0, 1, 2, 3, 3, 2, 1, 0, 1, 2, 3, 3, 2, 1, 0, 1, 2, 3, 3, 2, 1, 0, 1, 2, 3, 3, 2, 1, 0, 1, 2, 3, 3, 2, 1, 0, 1, 2, 3, 3, 2, 1, 0, 1, 2, 3, 3, 2, 1, 0, 1, 2, 3, 3, 2, 1, 0, 1, 2, 3, 3, 2, 1, 0, 1, 2, 3, 3, 2, 1, 0, 1, 2, 3, 3, 2, 1, 0, 1, 2, 3, 3, 2, 1, 0, 1
Offset: 0

Views

Author

Wesley Ivan Hurt, Dec 09 2016

Keywords

Crossrefs

Cf. A279313.
Cf. A010876.

Programs

  • Magma
    &cat[[0, 1, 2, 3, 3, 2, 1]: n in [0..10]];
  • Maple
    a:=n->[0, 1, 2, 3, 3, 2, 1][(n mod 7)+1]: seq(a(n), n=0..300);
  • Mathematica
    CoefficientList[Series[x*(1 + 2*x + 3*x^2 + 3*x^3 + 2*x^4 + x^5)/(1 - x^7), {x, 0, 100}], x]
    PadRight[{}, 120, {0, 1, 2, 3, 3, 2, 1}] (* Vincenzo Librandi, Dec 10 2016 *)

Formula

G.f.: x*(1 + 2*x + 3*x^2 + 3*x^3 + 2*x^4 + x^5)/(1 - x^7).
a(n) = (1/2) * Sum_{i=1..2n} (-1)^floor((i-1)/7).
a(n) = a(n-7) for n > 6.
a(n) = A279313(2n)/2.
a(n) = -m*(m^5 - 21*m^4 + 160*m^3 - 525*m^2 + 739*m - 714)/360 where m = n mod 7. - Luce ETIENNE, Nov 18 2018
Showing 1-10 of 11 results. Next