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-8 of 8 results.

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

A274921 Spiral constructed on the nodes of the triangular net in which each new term is the least positive integer distinct from its neighbors.

Original entry on oeis.org

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

Views

Author

Omar E. Pol, Jul 11 2016

Keywords

Comments

The structure of the spiral has the following properties:
1) Every 1 is surrounded by three equidistant 2's and three equidistant 3's.
2) Every 2 is surrounded by three equidistant 1's and three equidistant 3's.
3) Every 3 is surrounded by three equidistant 1's and three equidistant 2's.
4) Diagonals are periodic sequences with period 3 (A010882 and A130784).
From Juan Pablo Herrera P., Nov 16 2016: (Start)
5) Every hexagon with a 1 in its center is the same hexagon as the one in the middle of the spiral.
6) Every triangle whose number of numbers is divisible by 3 has the same number of 1's, 2's, and 3's. For example, a triangle with 6 numbers, has two 1's, two 2's, and two 3's. (End)
a(n) = a(n-2) if n > 2 is in A014591, otherwise a(n) = 6 - a(n-1)-a(n-2). - Robert Israel, Sep 15 2017

Examples

			Illustration of initial terms as a spiral:
.
.                3 - 1 - 2 - 3 - 1 - 2
.               /                     \
.              1   2 - 3 - 1 - 2 - 3   1
.             /   /                 \   \
.            2   3   1 - 2 - 3 - 1   2   3
.           /   /   /             \   \   \
.          3   1   2   3 - 1 - 2   3   1   2
.         /   /   /   /         \   \   \   \
.        1   2   3   1   2 - 3   1   2   3   1
.       /   /   /   /   /     \   \   \   \   \
.      2   3   1   2   3   1 - 2   3   1   2   3
.       \   \   \   \   \         /   /   /   /
.        1   2   3   1   2 - 3 - 1   2   3   1
.         \   \   \   \             /   /   /
.          3   1   2   3 - 1 - 2 - 3   1   2
.           \   \   \                 /   /
.            2   3   1 - 2 - 3 - 1 - 2   3
.             \   \                     /
.              1   2 - 3 - 1 - 2 - 3 - 1
.               \
.                3 - 1 - 2 - 3 - 1 - 2
.
		

Crossrefs

Programs

  • Maple
    A[0]:= 1: A[1]:= 2: A[2]:= 3:
    b:= 3: c:= 2: d:= 2: e:= 1: f:= 1:
    for n from 3 to 200 do
      if n = b then
         r:= b; b:= c + d - f + 1; f:= e; e:= d; d:= c; c:= r;
         A[n]:= A[n-2];
      else
         A[n]:= 6 - A[n-1] - A[n-2];
      fi
    od:
    seq(A[i],i=0..200); # Robert Israel, Sep 15 2017

Formula

a(n) = A274920(n) + 1.

A240438 Greatest minimal difference between numbers of adjacent cells in a regular hexagonal honeycomb of order n with cells numbered from 1 through the total number of cells, the order n corresponding to the number of cells on one side of the honeycomb.

Original entry on oeis.org

0, 1, 5, 11, 18, 28, 40, 53, 69, 87, 106, 128, 152, 177, 205, 235, 266, 300, 336, 373, 413, 455, 498, 544, 592, 641, 693, 747, 802, 860, 920, 981, 1045, 1111, 1178, 1248, 1320, 1393, 1469, 1547, 1626, 1708, 1792, 1877, 1965, 2055, 2146, 2240, 2336, 2433, 2533, 2635
Offset: 1

Views

Author

Jörg Zurkirchen, Apr 05 2014

Keywords

Comments

Difference table of a(n), with a(0)=0 and offset=0:
0, 0, 1, 5, 11, 18, 28, 40, 53, 69, ...
0, 1, 4, 6, 7, 10, 12, 13, 16, 18, ... = A047234(n+1)
1, 3, 2, 1, 3, 2, 1, 3, 2, 1, ... = A130784
2, -1, -1, 2, -1, -1, 2, -1, -1, 2, ... = -A131713(n+1)
-3, 0, 3, -3, 0, 3, -3, 0, 3, -3; ... = A099838(n+4)
3, 3, -6, 3, 3, -6, 3, 3, -6, 3, ...
0, -9, 9, 0, -9, 9, 0, -9, 9, 0, ...
-9, 18, -9, -9, 18, -9, -9, 18, -9, -9, ...
First column: see A057682. - Paul Curtz, Nov 11 2014
Diameter of the chamber graph Γ(Alt(2n+1)). Definition of this graph:
Each vertex v is a sequence (v[1],v[2],...,v[n]) of length n, where each v[i] is a 2-subset of {1,2,...,2n+1} and v[i] and v[j] are disjoint unless i=j.
Vertices u and v are connected iff either:
u and v are identical except for their first elements u[1] and v[1], or
u and v are identical except for some i for which u[i]=v[i+1] and v[i]=u[i+1] - Tim Crinion, 17 Feb 2019

Examples

			For n = 3 an example of a honeycomb with the greatest minimal difference of a(3) = 5 is:
.         __
.      __/ 7\__
.   __/15\__/13\__
.  / 4\__/ 2\__/ 1\
.  \__/10\__/ 8\__/
.  /18\__/16\__/14\
.  \__/ 5\__/ 3\__/
.  /12\__/11\__/ 9\
.  \__/19\__/17\__/
.     \__/ 6\__/
.        \__/
.
		

References

  • 22ème Championnat des jeux mathématiques et logiques - 1/4 de finale individuels 2008, problème 18, «Les ruches d’Abella»

Crossrefs

Programs

  • Magma
    [n*(n-1)-Floor((n+1)/3): n in [1..60]]; // Vincenzo Librandi, Nov 12 2014
  • Maple
    A240438:=n->n*(n-1)-floor((n+1)/3); seq(A240438(n), n=1..50); # Wesley Ivan Hurt, Apr 08 2014
  • Mathematica
    Table[n (n - 1) - Floor[(n + 1)/3], {n, 50}] (* Wesley Ivan Hurt, Apr 08 2014 *)
    CoefficientList[Series[x (x + 1) (2 x + 1) / ((1 - x)^3 (x^2 + x + 1)), {x, 0, 60}], x] (* Vincenzo Librandi, Nov 12 2014 *)
    LinearRecurrence[{2, -1, 1, -2, 1},{0, 1, 5, 11, 18},52] (* Ray Chandler, Sep 24 2015 *)

Formula

a(n) = n*(n-1)-floor((n+1)/3).
G.f.: -x^2*(x+1)*(2*x+1) / ((x-1)^3*(x^2+x+1)). - Colin Barker, Apr 08 2014
a(n+3) = a(n) + 6*n+5. - Paul Curtz, Nov 11 2014
a(n) = n^2 - (A042965(n+1)=0, 1, 3, 4, ...). - Paul Curtz, Nov 11 2014
a(n+1) = a(n) + A047234(n+1). - Paul Curtz, Nov 11 2014

A130785 Sequence identical to its third differences: a(n+3) = 3a(n+2)-3a(n+1)+2a(n), with a(0)=1, a(1)=4, a(2)=9.

Original entry on oeis.org

1, 4, 9, 17, 32, 63, 127, 256, 513, 1025, 2048, 4095, 8191, 16384, 32769, 65537, 131072, 262143, 524287, 1048576, 2097153, 4194305, 8388608, 16777215, 33554431, 67108864, 134217729, 268435457, 536870912, 1073741823, 2147483647, 4294967296, 8589934593
Offset: 0

Views

Author

Paul Curtz, Jul 15 2007

Keywords

Comments

From R. J. Mathar, Nov 22 2007: (Start)
Sequences which equal the sequence of their d-th differences obey linear recurrences with constant binomial coefficients of the form Sum_{i=0..d} binomial(d,d-i)*(-1)^i*a(n-i) = a(n-d).
If d is even, this simplifies to Sum_{i=0..d-1} binomial(d,d-i)*(-1)^i*a(n-i) = 0.
This binding of d (d odd) or d-1 (d even) consecutive terms by the recurrences leaves d or d-1, respectively, free parameters to choose a(0),a(1),...,a(d) or a(0),a(1),...,a(d-1), respectively, which ultimately define the individual sequence.
The generating functions are
d=2: a(0)/(1-2*x).
d=3: (1/3)*(-a(0) + a(1) - a(2))/(-1+2*x) + (1/3)*(-4*a(0)*x - x*a(2) + 4*a(1)*x - a(2) + 2*a(0) + a(1))/(x^2-x+1).
d=4: (1/2)*(-2*a(0) + 2*a(1) - a(2))/(-1+2*x) + (1/2)*(2*a(1)*x - 4*a(0)*x - a(2) + 2*a(1))/(1 - 2*x + 2*x^2).
In the present sequence we have d=3 and g.f. = (x-1)/(x^2-x+1) - 2/(-1+2*x). (End)
Also binomial transform of A130784. a(n) = 2^(n+1) + A010892(n+4).
Recurrence in shorter form: a(n) = 2*a(n) + periodically extended [2, 1, -1, -2, -1, 1].
See A130750, A130752, A130755 for other examples of d=3 sequences, A130781 for an example of d=4.

Examples

			Triangle of sequence and 1st, 2nd, 3rd differences:
  1   4   9  17  32  63 127 256 513
    3   5   8  15  31  64 129 257
      2   3   7  16  33  65 128
        1   4   9  17  32  63 ... equal to first row
		

Programs

  • Mathematica
    d = 3; nmax = 20; a[n_ /; n < d] := (n+1)^2; seq = Table[a[n], {n, 0, nmax}]; seq /. Solve[ Thread[ Take[seq, nmax - d + 1] == Differences[seq, d]]] // First (* Jean-François Alcover, Nov 07 2013 *)
    LinearRecurrence[{3, -3, 2},{1, 4, 9},21] (* Ray Chandler, Sep 23 2015 *)
    Table[2^(n + 1) - Cos[(2 n + 1) Pi/6] 2/Sqrt[3], {n, 0, 32}] (* Vladimir Reshetnikov, Oct 15 2017 *)

Formula

a(n) = 2^(n+1) - cos((2*n+1)*Pi/6) * 2/sqrt(3). - Vladimir Reshetnikov, Oct 15 2017
G.f.: (1+x)/((1-2*x)*(1-x+x^2)). - Joerg Arndt, Oct 16 2017

Extensions

Edited and extended by R. J. Mathar, Nov 22 2007

A131756 Period 3: repeat [2, -1, 3].

Original entry on oeis.org

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

Views

Author

Paul Curtz, Oct 04 2007

Keywords

Crossrefs

Cf. A130784.

Programs

Formula

a(n) = 4/3+2/3*cos(2/3*Pi*n)-4/3*3^(1/2)*sin(2/3*Pi*n). - R. J. Mathar, Nov 15 2007
G.f.: (2-x+3*x^2)/(1-x^3). - Jaume Oliver Lafont, Mar 24 2009
a(n) = a(n-3) for n>2. - Wesley Ivan Hurt, Jul 01 2016

A134977 Period 6: repeat [1, 4, 2, 3, 0, 2].

Original entry on oeis.org

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

Views

Author

Paul Curtz, Feb 04 2008

Keywords

Comments

Northwest diagonal sums of A134658, omitting row 0.

Crossrefs

Programs

Formula

O.g.f.: -1/(x+1)-2/(x-1)+x/(x^2-x+1). a(n) = 2-(-1)^n+A010892(n-1). - R. J. Mathar, Feb 08 2008
From Wesley Ivan Hurt, Jun 18 2016: (Start)
a(n) = a(n-1) - a(n-3) + a(n-4) for n>3.
a(n) = (6-3*cos(n*Pi)+2*sqrt(3)*sin(n*Pi/3))/3. (End)

A176977 Decimal expansion of (3+sqrt(37))/7.

Original entry on oeis.org

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

Views

Author

Klaus Brockhaus, Apr 30 2010

Keywords

Comments

Continued fraction expansion of (3+sqrt(37))/7 is A130784.

Examples

			1.29753750432831709842...
		

Crossrefs

Cf. A010491 (decimal expansion of sqrt(37)), A130784 (repeat 1, 3, 2).

Programs

  • Mathematica
    RealDigits[(3+Sqrt[37])/7,10,103][[1]] (* Stefano Spezia, May 26 2025 *)

A164360 Period 3: repeat [5, 4, 3].

Original entry on oeis.org

5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3
Offset: 0

Views

Author

Stephen Crowley, Aug 14 2009

Keywords

Comments

From Klaus Brockhaus, May 29 2010: (Start)
Continued fraction expansion of (32+sqrt(1297))/13.
Decimal expansion of 181/333. (End)

Crossrefs

Cf. A007877 (repeat 0,1,2,1), A068073 (repeat 1,2,3,2), A028356 (repeat 1,2,3,4,3,2), A130784 (repeat 1,3,2), A158289 (repeat 0,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1).
Cf. A178566 (decimal expansion of (32+sqrt(1297))/13). [Klaus Brockhaus, May 29 2010]

Programs

Formula

a(n) = 4+(-1)^n*((1/2+I*sqrt(3)/6)*((1+I*sqrt(3))/2)^n+(1/2-I*sqrt(3)/6)*((1-I*sqrt(3))/2)^n). [Corrected by Klaus Brockhaus, Sep 17 2009]
a(n) = 4+(1/3)*sqrt(3)*sin(2*n*Pi/3)+cos(2*n*Pi/3). [Corrected by Klaus Brockhaus, Sep 17 2009]
a(n) = a(n-3) for n > 2, with a(0) = 5, a(1) = 4, a(2) = 3.
G.f.: (5+4*x+3*x^2)/((1-x)*(1+x+x^2)). [Klaus Brockhaus, Sep 17 2009]
E.g.f.: 4*exp(x)+(1/3)*sqrt(3)*exp(-(1/2)*x)*sin((1/2)*x*sqrt(3))+exp(-(1/2)*x)*cos((1/2)*x*sqrt(3)).
a(n) = 4 + A057078(n). - Wesley Ivan Hurt, Jul 01 2016

Extensions

Edited by Klaus Brockhaus, Sep 17 2009
Offset changed to 0 and formulas adjusted by Klaus Brockhaus, May 18 2010
Showing 1-8 of 8 results.