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.

Previous Showing 11-20 of 32 results. Next

A324778 West spoke of spiral in A274641.

Original entry on oeis.org

0, 2, 4, 5, 6, 14, 9, 16, 12, 24, 13, 30, 19, 32, 33, 37, 34, 35, 22, 40, 51, 46, 52, 43, 29, 53, 60, 49, 50, 56, 70, 77, 80, 71, 78, 85, 92, 73, 90, 88, 97, 101, 104, 55, 105, 81, 96, 87, 94, 86, 58, 109, 67, 84, 124, 83, 125, 127, 115, 143, 91, 126, 141
Offset: 0

Views

Author

N. J. A. Sloane, Jul 05 2019

Keywords

Crossrefs

The 8 spokes are A324774-A324781. To get them, subtract 1 from A274924-A274931, respectively.

A324779 South-West spoke of spiral in A274641.

Original entry on oeis.org

0, 3, 5, 4, 13, 9, 10, 22, 15, 17, 20, 23, 18, 28, 45, 43, 29, 30, 57, 35, 32, 42, 40, 38, 39, 78, 77, 82, 46, 90, 56, 61, 55, 53, 60, 62, 58, 65, 114, 64, 72, 71, 74, 75, 130, 143, 91, 83, 80, 70, 81, 86, 163, 99, 171, 105, 103, 173, 178, 181, 104, 100, 190
Offset: 0

Views

Author

N. J. A. Sloane, Jul 05 2019

Keywords

Crossrefs

The 8 spokes are A324774-A324781. To get them, subtract 1 from A274924-A274931, respectively.

A324780 South spoke of spiral in A274641.

Original entry on oeis.org

0, 4, 1, 8, 12, 7, 6, 10, 9, 16, 18, 29, 22, 30, 15, 44, 33, 37, 38, 36, 42, 34, 55, 56, 50, 52, 63, 57, 39, 67, 62, 64, 72, 86, 47, 84, 91, 74, 99, 75, 51, 105, 106, 65, 109, 87, 116, 60, 107, 122, 124, 101, 127, 88, 103, 128, 133, 95, 131, 142, 115, 146
Offset: 0

Views

Author

N. J. A. Sloane, Jul 05 2019

Keywords

Crossrefs

The 8 spokes are A324774-A324781. To get them, subtract 1 from A274924-A274931, respectively.

A274640 Counterclockwise square spiral constructed by greedy algorithm, so that each row, column, and diagonal contains distinct numbers.

Original entry on oeis.org

1, 2, 3, 4, 2, 3, 4, 5, 6, 1, 4, 6, 2, 1, 6, 5, 3, 1, 5, 2, 6, 1, 2, 4, 5, 3, 7, 8, 5, 4, 9, 7, 8, 3, 10, 11, 4, 7, 8, 6, 3, 9, 5, 7, 8, 9, 10, 11, 12, 6, 8, 9, 11, 10, 12, 13, 7, 6, 10, 9, 12, 13, 14, 15, 8, 2, 9, 12, 7, 10, 11, 13, 14, 10, 9, 6, 13, 5, 3, 15, 16, 7, 1, 10, 13, 12, 14, 11, 15, 3, 8, 5, 1, 12, 11, 14, 7, 4, 2, 16, 9, 17, 1, 8, 11
Offset: 0

Views

Author

Zak Seidov and Kerry Mitchell, Jun 30 2016

Keywords

Comments

Presumably every row, column, and diagonal is a permutation of the natural numbers, but is there a proof? - N. J. A. Sloane, Jul 10 2016
The n-th cell in the spiral has coordinates x = A174344(n+1), y = A274923(n+1). - N. J. A. Sloane, Jul 11 2016
From Robert G. Wilson v, Dec 25 2016: (Start) [Memo: all these numbers need to decreased by 1, since the offset here is 0. See A324481. - N. J. A. Sloane, Jul 23 2017. Furthermore, the numbers don't seem correct, even after subtracting 1. - N. J. A. Sloane, Jul 04 2019]
Index of first appearance of k = 1,2,3,...: 1, 2, 3, 7, 8, 15, 17, 25, 35, 41, 47, 61, 62, 89, 98, 99, 121, 129, 130, 143, 197, 208, 225, 239, 271, ..., .
1 appears at: 1, 4, 12, 19, 22, 33, 42, 68, 79, 120, 179, 194, 302, 311, 445, 489, 511, 558, 630, 708, 847, 877, 907, ..., .
2 appears at: 2, 5, 9, 16, 48, 52, 70, 73, 88, 95, 110, 146, 280, 291, 309, 327, 488, 605, 656, 681, 735, 778, 1000, ..., .
3 appears at: 3, 6, 10, 23, 29, 36, 56, 76, 97, 105, 153, 168, 184, 252, 338, 437, 457, 670, 818, 906, 953, 967, ..., . (End).

Examples

			The spiral begins:
.
   9--16---2---4---7--14--11--12---1---5---8
   |                                       |
  17   8--15--14--13--12---9--10---6---7   3
   |   |                               |   |
   1   2   4--11--10---3---8---7---9  13  15
   |   |   |                       |   |   |
   8   9   7   3---5---6---1---2   4  12  11
   |   |   |   |               |   |   |   |
  11  12   8   1   2---4---3   6   5  10  14
   |   |   |   |   |       |   |   |   |   |
  15   7   6   5   3   1---2   4   8  11  12
   |   |   |   |   |           |   |   |   |
  14  10   3   2   4---5---6---1   7   9  13
   |   |   |   |                   |   |   |
   7  11   9   6---1---2---4---5---3   8  10
   |   |   |                           |   |
   4  13   5---7---8---9--10--11--12---6   1
   |   |                                   |
  12  14--10---9---6--13---5---3--15--16---7
   |
  10--15---1--12--16---8--14--13--11--18--17
.
The 8 spokes (A274924-A274931) begin:
  E:  1, 2, 4,  8, 11, 12, 16,  9, 19, 24, 22, ...
  NE: 1, 3, 2,  9,  7,  8, 12, 15, 13, 17, 20, ...
  N:  1, 4, 6,  3, 12, 14, 15, 18, 20, 26, 25, ...
  NW: 1, 2, 3,  4,  8,  9,  7, 11, 14, 10, 22, ...
  W:  1, 3, 5,  6,  7, 15, 10, 17, 13, 25, 14, ...
  SW: 1, 4, 6,  5, 14, 10, 11, 23, 16, 18, 21, ...
  S:  1, 5, 2,  9, 13,  8,  7, 11, 10, 17, 19, ...
  SE: 1, 6, 5, 12, 16, 17, 21, 24, 27, 13, 15, ...
		

Crossrefs

Cf. A274641 (the same spiral, but starting with 0 not 1), A174344, A274923.
The 8 spokes are A274924-A274931.
The East-West axis is A275877 (see also A324680), the North-South axis is A276036.
Positions of 1's and 2's give A273059 and A275116.
In the same spirit as the infinite Sudoku array A269526.
Cf. A324481 (position of first n).
Cf. A274821 (the same construction on a hexagonal tiling).

Programs

  • Maple
    #  Maple program from Alois P. Heinz, Jul 12 2016:
    fx:= proc(n) option remember; `if`(n=1, 0, (k->
           fx(n-1)+sin(k*Pi/2))(floor(sqrt(4*(n-2)+1)) mod 4))
         end:
    fy:= proc(n) option remember; `if`(n=1, 0, (k->
           fy(n-1)-cos(k*Pi/2))(floor(sqrt(4*(n-2)+1)) mod 4))
         end:
    b:= proc() 0 end:
    a:= proc(n) local x,y,s,i,t,m;
          x, y:= fx(n+1), fy(n+1);
          if b(x, y) > 0 then b(x, y)
        else s:={};
        for i do t:=b(x+i,y+i); if t>0 then s:=s union {t} else break fi od;
        for i do t:=b(x-i,y-i); if t>0 then s:=s union {t} else break fi od;
        for i do t:=b(x+i,y-i); if t>0 then s:=s union {t} else break fi od;
        for i do t:=b(x-i,y+i); if t>0 then s:=s union {t} else break fi od;
        for i do t:=b(x+i,y  ); if t>0 then s:=s union {t} else break fi od;
        for i do t:=b(x-i,y  ); if t>0 then s:=s union {t} else break fi od;
        for i do t:=b(x  ,y+i); if t>0 then s:=s union {t} else break fi od;
        for i do t:=b(x  ,y-i); if t>0 then s:=s union {t} else break fi od;
             for m while m in s do od;
             b(x,y):= m
          fi
        end:
    seq(a(n), n=0..1000);
  • Mathematica
    fx[n_] := fx[n] = If[n == 1, 0, Function[k, fx[n-1] + Sin[k*Pi/2]][Mod[Floor[Sqrt[4*(n-2)+1]], 4]]]; fy[n_] := fy[n] = If[n == 1, 0, Function[k, fy[n-1] - Cos[k*Pi/2]][Mod[Floor[Sqrt[4*(n-2)+1]], 4]]]; Clear[b]; b[, ] = 0; a[n_] := Module[{x, y, s, i, t, m}, {x, y} = {fx[n+1], fy[n+1]}; If[b[x, y] > 0, b[x, y], s = {};
    For[i=1, True, i++, t=b[x+i, y+i]; If[t>0, s=Union[s,{t}], Break[]]];
    For[i=1, True, i++, t=b[x-i, y-i]; If[t>0, s=Union[s,{t}], Break[]]];
    For[i=1, True, i++, t=b[x+i, y-i]; If[t>0, s=Union[s,{t}], Break[]]];
    For[i=1, True, i++, t=b[x-i, y+i]; If[t>0, s=Union[s,{t}], Break[]]];
    For[i=1, True, i++, t=b[x+i, y  ]; If[t>0, s=Union[s,{t}], Break[]]];
    For[i=1, True, i++, t=b[x-i, y  ]; If[t>0, s=Union[s,{t}], Break[]]];
    For[i=1, True, i++, t=b[x  , y+i]; If[t>0, s=Union[s,{t}], Break[]]];
    For[i=1, True, i++, t=b[x  , y-i]; If[t>0, s=Union[s,{t}], Break[]]];
    m = 1; While[MemberQ[s, m], m++]; b[x, y] = m]]; Table[a[n], {n, 0, 1000}] (* Jean-François Alcover, Nov 14 2016, after Alois P. Heinz *)
  • Python
    class Lines: # manage lines in direction d = dx + dy*1j
        def _init_(self, d):
            self.lines={}; self.t = d.real/d.imag if d.imag else None
        def _call_(self, pos): # Return the line through pos in direction d
            index = pos.imag if self.t is None else pos.real - pos.imag*self.t
            if index not in self.lines: self.lines[index] = Values()
            return self.lines[index]
    class Values(set): # the set of used numbers on a given line
        def next(self, n): # return least k >= n not on this line
            return min(m+1 for m in self if m+1 >= n and m+1 not in self
                       ) if n in self else n
    def A274640(): # generator of the sequence, see below for possible usage
        lines = [Lines(d) for d in (1, 1+1j, 1j, 1-1j)]; pos = 0
        for side in range(9**9):
            for _ in range(side//2 + 1):
                n = 1; lines_here = [L(pos) for L in lines]
                while any(n < (n := L.next(n)) for L in lines_here): pass
                yield n; any(L.add(n) for L in lines_here); pos += 1j**side
    [a for a,A274640(),range(99))%5D%20%23%20_M.%20F.%20Hasler"> in zip(A274640(),range(99))] # _M. F. Hasler, Feb 01 2025

Extensions

Corrected and extended by Alois P. Heinz, Jul 12 2016

A317186 One of many square spiral sequences: a(n) = n^2 + n - floor((n-1)/2).

Original entry on oeis.org

1, 2, 6, 11, 19, 28, 40, 53, 69, 86, 106, 127, 151, 176, 204, 233, 265, 298, 334, 371, 411, 452, 496, 541, 589, 638, 690, 743, 799, 856, 916, 977, 1041, 1106, 1174, 1243, 1315, 1388, 1464, 1541, 1621, 1702, 1786, 1871, 1959, 2048, 2140, 2233, 2329, 2426
Offset: 0

Views

Author

N. J. A. Sloane, Jul 27 2018

Keywords

Comments

Draw a square spiral on a piece of graph paper, and label the cells starting at the center with the positive (resp. nonnegative) numbers. This produces two versions of the labeled square spiral, shown in the Example section below.
The spiral may proceed clockwise or counterclockwise, and the first arm of the spiral may be along any of the four axes, so there are eight versions of each spiral. However, this has no effect on the resulting sequences, and it is enough to consider just two versions of the square spiral (starting at 1 or starting at 0).
The present sequence is obtained by reading alternate entries on the X-axis (say) of the square spiral started at 1.
The cross-references section lists many sequences that can be read directly off the two spirals. Many other sequences can be obtained from them by using them to extract subsequences from other important sequences. For example, the subsequence of primes indexed by the present sequence gives A317187.
a(n) is also the number of free polyominoes with n + 4 cells whose difference between length and width is n. In this comment the length is the longer of the two dimensions and the width is the shorter of the two dimensions (see the examples of polyominoes). Hence this is also the diagonal 4 of A379625. - Omar E. Pol, Jan 24 2025
From John Mason, Feb 19 2025: (Start)
The sequence enumerates polyominoes of width 2 having precisely 2 horizontal bars. By classifying such polyominoes according to the following templates, it is possible to define a formula that reduces to the one below:
.
OO O O
O OO OO
O O O
O O OO
OO OO O
.
(End)

Examples

			The square spiral when started with 1 begins:
.
  100--99--98--97--96--95--94--93--92--91
                                        |
   65--64--63--62--61--60--59--58--57  90
    |                               |   |
   66  37--36--35--34--33--32--31  56  89
    |   |                       |   |   |
   67  38  17--16--15--14--13  30  55  88
    |   |   |               |   |   |   |
   68  39  18   5---4---3  12  29  54  87
    |   |   |   |       |   |   |   |   |
   69  40  19   6   1---2  11  28  53  86
    |   |   |   |           |   |   |   |
   70  41  20   7---8---9--10  27  52  85
    |   |   |                   |   |   |
   71  42  21--22--23--24--25--26  51  84
    |   |                           |   |
   72  43--44--45--46--47--48--49--50  83
    |                                   |
   73--74--75--76--77--78--79--80--81--82
.
For the square spiral when started with 0, subtract 1 from each entry. In the following diagram this spiral has been reflected and rotated, but of course that makes no difference to the sequences:
.
   99  64--65--66--67--68--69--70--71--72
    |   |                               |
   98  63  36--37--38--39--40--41--42  73
    |   |   |                       |   |
   97  62  35  16--17--18--19--20  43  74
    |   |   |   |               |   |   |
   96  61  34  15   4---5---6  21  44  75
    |   |   |   |   |       |   |   |   |
   95  60  33  14   3   0   7  22  45  76
    |   |   |   |   |   |   |   |   |   |
   94  59  32  13   2---1   8  23  46  77
    |   |   |   |           |   |   |   |
   93  58  31  12--11--10---9  24  47  78
    |   |   |                   |   |   |
   92  57  30--29--28--27--26--25  48  79
    |   |                           |   |
   91  56--55--54--53--52--51--50--49  80
    |                                   |
   90--89--88--87--86--85--84--83--82--81
.
From _Omar E. Pol_, Jan 24 2025: (Start)
For n = 0 there is only one free polyomino with 0 + 4 = 4 cells whose difference between length and width is 0 as shown below, so a(0) = 1.
   _ _
  |_|_|
  |_|_|
.
For n = 1 there are two free polyominoes with 1 + 4 = 5 cells whose difference between length and width is 1 as shown below, so a(1) = 2.
   _ _     _ _
  |_|_|   |_|_|
  |_|_|   |_|_
  |_|     |_|_|
.
(End)
		

Crossrefs

Sequences on the four axes of the square spiral: Starting at 0: A001107, A033991, A007742, A033954; starting at 1: A054552, A054556, A054567, A033951.
Sequences on the four diagonals of the square spiral: Starting at 0: A002939 = 2*A000384, A016742 = 4*A000290, A002943 = 2*A014105, A033996 = 8*A000217; starting at 1: A054554, A053755, A054569, A016754.
Sequences obtained by reading alternate terms on the X and Y axes and the two main diagonals of the square spiral: Starting at 0: A035608, A156859, A002378 = 2*A000217, A137932 = 4*A002620; starting at 1: A317186, A267682, A002061, A080335.
Filling in these two squares spirals with greedy algorithm: A274640, A274641.
Cf. also A317187.

Programs

  • Mathematica
    a[n_] := n^2 + n - Floor[(n - 1)/2]; Array[a, 50, 0] (* Robert G. Wilson v, Aug 01 2018 *)
    LinearRecurrence[{2, 0, -2 , 1},{1, 2, 6, 11},50] (* or *)
    CoefficientList[Series[(- x^3 - 2 * x^2 - 1) / ((x - 1)^3 * (x + 1)), {x, 0, 50}], x] (* Stefano Spezia, Sep 02 2018 *)

Formula

From Daniel Forgues, Aug 01 2018: (Start)
a(n) = (1/4) * (4 * n^2 + 2 * n + (-1)^n + 3), n >= 0.
a(0) = 1; a(n) = - a(n-1) + 2 * n^2 - n + 2, n >= 1.
a(0) = 1; a(1) = 2; a(2) = 6; a(3) = 11; a(n) = 2 * a(n-1) - 2 * a(n-3) + a(n-4), n >= 4.
G.f.: (- x^3 - 2 * x^2 - 1) / ((x - 1)^3 * (x + 1)). (End)
E.g.f.: ((2 + 3*x + 2*x^2)*cosh(x) + (1 + 3*x + 2*x^2)*sinh(x))/2. - Stefano Spezia, Apr 24 2024
a(n)+a(n+1)=A033816(n). - R. J. Mathar, Mar 21 2025
a(n)-a(n-1) = A042948(n), n>=1. - R. J. Mathar, Mar 21 2025

A274820 Spiral constructed on the nodes of the infinite triangular net in which each term is the least nonnegative integer such that no diagonal contains a repeated term.

Original entry on oeis.org

0, 1, 2, 1, 2, 1, 2, 0, 3, 0, 4, 3, 5, 3, 4, 5, 3, 4, 6, 5, 6, 7, 4, 6, 5, 7, 6, 3, 0, 6, 5, 7, 0, 6, 7, 5, 4, 8, 1, 3, 6, 8, 1, 9, 7, 8, 2, 4, 9, 8, 2, 10, 11, 8, 9, 10, 12, 3, 8, 9, 7, 10, 9, 2, 4, 8, 5, 10, 2, 11, 9, 11, 0, 10, 7, 8, 6, 0, 9, 7, 10, 12, 7, 1, 4, 8, 5, 11, 1, 10, 12, 9, 5, 11, 10, 13, 12, 11, 13, 14
Offset: 0

Views

Author

Omar E. Pol, Jul 09 2016

Keywords

Comments

Also spiral constructed on the infinite hexagonal grid in which each term is the least nonnegative integer such that no diagonal of successive adjacent cells contains a repeated term. Every number is located in the center of a hexagonal cell. Every cell is also the center of three diagonals of successive adjacent cells.
Presumably every line of cells with slope a multiple of 60 degrees (not necessarily passing through the central cell) is a permutation of the nonnegative numbers. See A296343-A296348 for the spokes through the central cell. - N. J. A. Sloane, Dec 12 2017

Examples

			Illustration of initial terms as a spiral:
.
.                   9 - 4 - 2 - 8 - 7
.                  /                 \
.                 8   3 - 6 - 7 - 5   9
.                /   /             \   \
.               2   0   5 - 3 - 4   6   1
.              /   /   /         \   \   \
.            10   6   3   1 - 2   0   4   8
.            /   /   /   /     \   \   \   \
.          11   5   4   2   0 - 1   3   7   6
.            \   \   \   \         /   /   /
.             8   7   5   1 - 2 - 0   6   3
.              \   \   \             /   /
.               9   0   3 - 4 - 6 - 5   1
.                \   \                 /
.                10   6 - 7 - 5 - 4 - 8
.                  \
.                  12 - 3 - 8 - 9 - 7
.
		

Crossrefs

Cf. A001477, A269526, A274528 (square array), A274641 (spiral on the square grid), A274650 (right triangle), A274821, A274920, A274921, A275606, A275610, A296339.
A296342 says when n first appears.
See A296343-A296348 for the spokes.

Programs

  • PARI
    See Links section.

Formula

a(n) = A274821(n) - 1.

A274924 East spoke of spiral in A274640.

Original entry on oeis.org

1, 2, 4, 8, 11, 12, 16, 9, 19, 24, 22, 18, 27, 26, 21, 37, 43, 39, 40, 49, 28, 29, 32, 46, 55, 60, 45, 48, 66, 73, 70, 76, 83, 77, 65, 75, 42, 62, 94, 96, 101, 103, 67, 63, 112, 80, 113, 58, 107, 64, 108, 120, 109, 69, 124, 130, 140, 134, 122, 133, 139, 129
Offset: 0

Views

Author

N. J. A. Sloane, Jul 12 2016

Keywords

Crossrefs

Cf. A274640, A274641. The 8 spokes are A274924-A274931.

Extensions

More terms from Alois P. Heinz, Jul 12 2016

A274931 Southeast spoke of spiral in A274640.

Original entry on oeis.org

1, 6, 5, 12, 16, 17, 21, 24, 27, 13, 15, 36, 40, 43, 47, 54, 23, 56, 59, 62, 39, 68, 69, 35, 46, 37, 42, 90, 50, 97, 94, 99, 102, 57, 107, 115, 117, 116, 120, 66, 130, 131, 73, 77, 140, 143, 76, 80, 78, 159, 161, 156, 165, 92, 91, 174, 89, 181, 104, 187, 190
Offset: 0

Views

Author

N. J. A. Sloane, Jul 12 2016

Keywords

Crossrefs

Cf. A274640, A274641. The 8 spokes are A274924-A274931.

Extensions

More terms from Alois P. Heinz, Jul 12 2016

A307282 Sprague-Grundy values for Maharaja Nim on the counterclockwise square spiral.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 4, 6, 5, 7, 9, 8, 10, 1, 9, 2, 10, 3, 9, 11, 10, 2, 0, 3, 11, 10, 4, 1, 0, 6, 12, 7, 5, 3, 0, 8, 7, 1, 4, 5, 0, 2, 1, 12, 13, 6, 7, 1, 14, 8, 12, 3, 2, 9, 8, 10, 3, 2, 13, 4, 6, 7, 11, 13, 6, 12, 15, 14, 16, 8, 10, 7, 14, 4, 5, 3, 15
Offset: 0

Views

Author

N. J. A. Sloane, Apr 05 2019

Keywords

Comments

A Maharaja is a piece which can move both like a queen and a knight.
A274641 is the analogous sequence if the piece is a chess queen.

Examples

			The counterclockwise square spiral begins:
.
  16--15--14--13--12
   |               |
  17   4---3---2  11   .
   |   |       |   |
  18   5   0---1  10   .
   |   |           |
  19   6---7---8---9   .
   |
  20--21--22--23--24--25
.
		

Crossrefs

For the P-positions see A307283.

Programs

  • PARI
    See Links section.

Extensions

More terms from Rémy Sigrist, Apr 06 2019

A280027 Fill an infinite square array by following a spiral around the origin; in the central cell enter a(0)=1; thereafter, in the n-th cell, enter the sum of the entries of those earlier cells that can be seen from that cell.

Original entry on oeis.org

1, 1, 2, 4, 7, 13, 23, 42, 76, 146, 239, 441, 852, 1389, 2536, 4971, 9832, 15312, 27964, 54801, 108787, 169086, 308758, 603612, 1201837, 2397202, 3656904, 6687912, 13067709, 25998877, 51918269, 79176868, 144799285, 282915788, 562653823, 1124083053, 2246758839
Offset: 0

Views

Author

N. J. A. Sloane, Dec 24 2016

Keywords

Comments

The spiral track being used here is the same as in A274640, except that the starting cell here is indexed 0 (as in A274641).
The central cell gets index 0 (and we fill it in with the value a(0)=1).
"Can be seen from" means "that are on the same row, column, diagonal, or antidiagonal as".

Examples

			The central portion of the spiral is:
.
     7----4----2
     |         |
    13    1----1  239
     |             |
    23---42---76--146
.
After the terms a(0) to a(8) of the spiral have been filled in, the next cell contains 76+42+23+1+4 = 146 = a(9).
		

Crossrefs

Extensions

More terms from Lars Blomberg, Dec 25 2016
Previous Showing 11-20 of 32 results. Next