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

A336335 a(n) is the index of the first occurrence of the Euclidean distance prime(n) from a point on a square spiral to its starting point at 1.

Original entry on oeis.org

11, 28, 50, 176, 452, 536, 848, 1388, 2048, 1682, 3752, 4784, 6272, 7268, 8696, 7938, 13748, 14210, 17756, 19952, 11888, 24728, 27308, 25322, 20456, 38888, 42128, 45476, 32792, 49826, 64136, 68252, 43698, 76868, 77930, 90752, 69216, 105788, 111056, 108354, 127628
Offset: 1

Views

Author

Hugo Pfoertner, Jul 24 2020

Keywords

Examples

			  37--36--35--34--33--32--31
   |                       |
  38  17--16--15--14--13  30  ...
   |   |               |   |   |
  39  18   5---4---3  12  29  54
   |   |   |       |   |   |   |
  40  19   6   1---2 d=2 d=3  53
   |   |   |           |   |   |
  41  20   7---8---9--10  27  52
   |   |                   |   |
  42  21--22--23--24--25--26  51
   |                           |
  43--44--45--46--47--48--49-d=5
.
a(1) = 11 is the index of the first occurrence of distance d = 2 = prime(1) from the start of the spiral.
a(2) = 28 is the index of the first occurrence of distance d = 3 = prime(2) from the start of the spiral.
Distances of the form 4*k+1 corresponding to Pythagorean primes A002144 occur earlier than on the East spoke of the square spiral, dependent on the decomposition of p^2 into two squares. prime(3)^2 = 4^2 + 3^2 leads to index a(3) = 50 in the spiral.
		

Crossrefs

Formula

a(n) = A054552(prime(n)) if prime(n) != 1 mod 4.

A357046 Squares visited by a knight moving on a board covered with horizontal dominoes [m|m], m = 0, 1, 2, ... in a diamond-shaped spiral, when the knight always jumps to the unvisited square with the least number on the corresponding domino.

Original entry on oeis.org

0, 11, 14, 1, 4, 13, 10, 3, 18, 7, 2, 5, 22, 9, 28, 31, 60, 15, 32, 29, 52, 25, 8, 27, 12, 53, 26, 23, 6, 17, 34, 59, 30, 87, 126, 51, 24, 45, 20, 39, 16, 33, 58, 55, 86, 125, 50, 47, 76, 21, 40, 67, 36, 61, 94, 57, 54, 85, 176, 129, 56, 93, 138, 187, 92, 137, 96, 35, 38, 19
Offset: 0

Views

Author

M. F. Hasler, Oct 19 2022

Keywords

Comments

The sequence lists the squares visited by the knight by giving their (unique) "square spiral number", as shown, e.g., in A316328 and others. (Listing the labels m of the dominoes would obviously be ambiguous; see EXAMPLE for that sequence.)
The dominoes [m|m], m = 0, 1, 2, ... are placed in a diamond-shaped spiral,
12 12 28 28
_ 13 13 11 11 27 27 _
14 14 [2 | 2] 10 10 26 26
_ 15 15 [3 | 3] [1 | 1] [9 | 9] 25
_ 16 [4 | 4] [0 | 0] [8 | 8] 24 24
The spiral starts from the origin (where the [0|0] is placed) with one step in direction North-East (where [1|1] is placed), then one in direction North-West (=> [2|2]), then two towards South-West (=> [3|3] and [4|4]) and two towards South-East (=> [5|5] and [6|6]), then three towards North-East, etc. [We chose the counter-clockwise spiral as usual in mathematics, but one would obviously get the same sequence if the spiral of dominoes and the square spiral numbering the positions were chosen in the opposite, clockwise sense.]
The endpoints of the "straight lines" are labeled with the "quarter-squares" A002620, in particular, rightmost and leftmost dominoes of each "shell" are labeled with the odd resp. even square numbers.
The sequence ends at a(2550) where the knight is stuck at position (x, y) = (28, 4) on the domino labeled m = 964.

Examples

			The knight hops from the left 0 (= the origin) on the right 1, then on the left 2, then on the right 0, then on the left 3, then on the right 2, etc.
The list of these labels would be 0, 1, 2, 0, 3, 2, 8, 3, 4, 5, 1, 4, 6, 7, 9, 11, 12, 14, 11, 10, 24, 22, 7, 8, 10, 9, 23, 6, 5, 15, 13, 12, 27, 26, 48, 23, ...
As explained in comments, the terms a(n) correspond to the (unique) "square spiral numbers" of these locations (cf. A274641 or A174344 (upside down) or A316328).
		

Crossrefs

Cf. A316328, A326924 and A326922 (choose square closest to the origin), A328908 and A328928 (variant using taxicab distance); A328909 and A328929 (variant using sup norm).
Cf. A274641, A174344 (upside down), A268038, A274923 for the square spiral numbering and corresponding (x,y) coordinates.

Programs

  • PARI
    /* function domino([x,y]) gives the label m on the domino at (x,y); it uses the map DOM to store this label with key x + i*y. */
    DOM=Map(); {domino(x)=while(!mapisdefined(DOM, x[1]+I*x[2], &x), my(M=#DOM\2, side=sqrtint(M*4-!!M), pos=sqrtint(M)*I^(side-1)+side\/2%2*I, dir=(1+I)*I^side); for(m=M, M+side\2, mapput(DOM, pos, m); mapput(DOM, pos+1, m); pos+=dir)); x}
    {coords(n, m=sqrtint(n), k=m\/2)=if(m<=n-=4*k^2, [n-3*k, -k], n>=0, [-k, k-n], n>=-m, [-k-n, k], [k, 3*k+n])}
    {local(U=[]/* used squares */, K=vector(8, i, [(-1)^(i\2)<<(i>4), (-1)^i<<(i<5)])/* knight moves */, pos(x, y)=if(y>=abs(x), 4*y^2-y-x, -x>=abs(y), 4*x^2-x-y, -y>=abs(x), (4*y-3)*y+x, (4*x-3)*x+y), t(x, p=pos(x[1], x[2]))=if(p<=U[1]||setsearch(U, p), oo, [domino(x), p]), nxt(p, x=coords(p))=vecsort(apply(K->t(x+K), K))[1][2]); my(A=List(0)/*list of positions*/); for(n=1, oo, U=setunion(U, [A[n]]); while(#U>1&&U[2]==U[1]+1, U=U[^1]); iferr(listput(A, nxt(A[n])), E, break)); print("Index of last term: ", #A-1); A357046(n)=A[n+1];} \\ same code as A326924 except for norml2 => domino
    /* to get the sequence of labels m (cf.example): */
    [domino(coords(A357046(n))) | n <- [0..99]]

A364130 An infinite 2d grid is filled with the positive integers by placing them clockwise in the narrow von Neumann's neighborhood of square s, the lowest number with open neighbors. a(n) is then the n-th term when the grid is read as a clockwise square spiral.

Original entry on oeis.org

1, 2, 8, 3, 15, 4, 22, 5, 10, 37, 6, 31, 32, 9, 12, 84, 85, 16, 18, 154, 155, 23, 26, 11, 38, 58, 57, 7, 50, 51, 52, 33, 64, 13, 96, 97, 98, 86, 17, 19, 172, 173, 174, 156, 24, 27, 73, 39, 59, 431, 430, 429, 43, 386, 387, 388, 389, 53, 34, 65, 14, 123, 124
Offset: 1

Views

Author

John Tyler Rascoe, Jul 09 2023

Keywords

Comments

This is a variant of A361207, where the size of a square's neighborhood is dependent on the value of that square rather than being of fixed size.
The neighborhood of square s is defined as the narrow von Neumann's neighborhood of radius s, see Zaitsev link. This consists of s squares in a straight line starting at square s, in each of the four directions east, south, west, and north.
To begin, 1 is placed at square (x,y) = (0,0); this then becomes square s = 1. Integers are then added sequentially to the open squares within the neighborhood of square s. The next number added to the grid is always the smallest positive integer not yet present on the grid.
Each direction of a square's neighborhood is first filled moving outwards before moving to the next direction. The order of cycling through the directions is always east, south, west, then north. Numbers are added to a given direction until either it is full, or a filled square is encountered. The process moves to the next direction regardless of any open squares remaining past the encountered filled square in that current direction of the neighborhood. Once the process has cycled through all directions of the neighborhood of a given square s, the process is repeated at square s+1.
The filled grid is then read as a clockwise square spiral, oriented east starting at (0,0). a(n) is the n-th term along the square spiral.

Examples

			For s = 2, the eastern and then southern directions are filled moving outward from s. Then in the western direction a filled square is encountered so the process moves on to the northern direction of 2's neighborhood.
For s = 3, starting in the eastern direction a filled square is immediately encountered. The process then moves to the southern direction even thought there are open squares remaining in the eastern direction of 3's neighborhood.
The spiral begins:
.
                    25
.
                    24
.
                    23      11
.
                    22---5--10
.                    |
    21  20  19  18   4   1---2   6   7
.                    |       |
            17  16  15---3---8
.
                        12   9
.
                        13
.
                        14
		

Crossrefs

Cf. A174344, A268038 (spiral coordinates).

Programs

  • Python
    # see linked program

A332067 a(n) is the square spiral number of the initial digit of the number placed at the n-th move of the Prime scrabble game: placing integers on a grid one digit per cell as to form primes, with minus sign in case of vertical placement.

Original entry on oeis.org

0, 1, 2, 8, 5, 18, 19, 23, 13, 15, 20, 37, 11, 68, 150, -26, 44, 70, -47, -114, 53, -216, -35, -77, 103, 64, -32, 61, 31, 146, -50, 162, 159, 152, -80, -166, 54, -154, -117, -72, 38, 157, -97, 142, 266, -281, -57, -431, -94, -277, 84, -123, -126, 144, -121, 268, 56, 264, -138, -284, 200, -223, -112, 209, -350, 330, -110, 339, -90, 492, -96, -275
Offset: 0

Views

Author

M. F. Hasler and Eric Angelini, May 05 2020

Keywords

Comments

Inspired by Eric Angelini's "Cross my primes", cf. links.
Starting with a 2 at the center, place at each move the smallest possible positive integer not used earlier, according to the following rules:
(1) The d digits of the integer are placed on a run of d consecutive squares which must be empty, either in horizontal (left-to-right) or vertical (downward) direction.
(2) At least one of these squares must be adjacent to a nonempty square.
(3) All numbers (with more than 1 digit) formed by filling the squares in that way, reading maximal uninterrupted runs of nonempty squares either left-to-right or downwards, must be primes.
(4) If the same (least) number can be placed in different ways, we choose according to 3 criteria in this order:
(a) We try to place the smallest possible integer also in the subsequent move. If different choices don't lead to the same minimum number placed at the next move, only those with the smallest possible "successor" are allowed: see the placement of 1 in the EXAMPLE.
(b) Among choices equivalent w.r.t. (a), choose the placement with the barycenter (mean of position of first and last digit) closest to the origin, according to the Euclidean norm.
(c) In case of a tie w.r.t. (b), prefer the placement with least maximum square spiral number of the positions of all digits.
The terms a(n) of this sequence give the position of the square where the first digit of the number is placed on the n-th move, through the "clockwise square spiral number" as defined through A174344 and A268038, and with a minus sign for a vertical placement, cf. EXAMPLE for a(15).
Almost all numbers are placed in their natural order, i.e., n at the n-th move.
"Late bird" numbers n placed not at but only after the n-th move are (1, 6, 14, 32, 34, ...); the next cases happen only around n = 250 and then n = 328.
The number of possibilities of placing a given number at the n-th move grows roughly as sqrt(n log n): It is roughly proportional to the number of digits at the border of the convex hull of the filled squares, which is roughly circular. The circumference is proportional to the radius r, while the area proportional to r^2 is also proportional to the number of filled cells. At the n-th move we fill roughly log_10(n) squares with digits, so the area grows like O(n log n) and the circumference is the square root of this.
Since the numbers cannot be split (cf. rule 1), we know that a run of only d consecutive empty squares in either direction will remain empty forever once we have used all numbers < 10^d (cf. EXAMPLE). This contrasts with a variant where the numbers can be split "around" already occupied squares. In that variant one can conjecture that each square will eventually be filled.

Examples

			To the right we show the square spiral used for labeling        20 21 22 23 24...
  each position (x,y) of the grid with a nonnegative integer,   19  6--7--8--9  :
  cf. A268038. (Counterclockwise numbering would be equally     18  5  0--1 10  :
  possible, as would be diamond- or hexagonal or yet            17  4--3--2 11  :
  differently shaped spirals. The clockwise square spiral       16 15 14 13 12  :
  numbering happens to give the smallest a(2) = 2.)
Since only primes are allowed, we start with a 2 placed at the center (0,0) of the infinite square board, which has the square spiral number 0, whence a(0) = 0.
Now we can't form a prime by adding a 1 to either side of that square. However, we can form the prime 23 by placing the only digit of the number 3 below or right to the initial 2. Since the square with the smallest square spiral number must be preferred, we must place the 3 at (1,0) with square spiral number 1, so a(1) = 1.
Now we can use the number 1 above or below the 3 to form the prime 13 or 31. The first choice would not allow placement of the number 4 in the next move: 431 is prime, but 413 is composite, as is 423; even though 41 would be prime, the 4 can't be above the 2 since 42 is composite. So we make the second choice, 1 placed on (1,-1) with square spiral number 2, and a(2) = 2. After the next moves we arrive at:
           8      after 4 placed on (1,1): a(4) = 8 (producing prime 431),
     6     4            5 placed on (-1,0): a(5) = 5 (producing prime 523),
     7 5 2 3            7 placed on (-2,0): a(6) = 18 (producing prime 7523),
           1            6 placed on (-2,1): a(7) = 19 (producing prime 67),
       1 0 9            etc. (see below).
There is no way to place 6 after a(5) = 5.
8 produces the prime 8431, 9 produces the prime 84319, and 10 produces the prime 109 by being glued horizontally to the left of the 9.
At move 100 we have:
                              1
                              0
                              0
                              4
                          6   8 8 7
              8 2 7   5   5   4     6
                  2   0   2   6     0   6
          6 8 6 4 4 2 3 2 2 3 3     3   2
                  6   6   2     3   4   5
    9 2 8 8 5 6 3 7 4 3   0   2 9   3   5   8
                8   0     1 7 4 1   6   5   5
        7 6 4 5 3 5 1 8 1 1   8 9   3   2   7
                        6     4   1 1 5 1   8
        7 5 5 8 1 4 1 5 7 5 2 3   6     5 7 7
            9   8     4 1     1 1 3 2 1 3   8
            7   9 2 5 1 2 1 0 9     3 7     1
  8 6 7 0 6 6 6 1       2     2 2 9       9
            9   3 0 2 6 3 2 8 7   4 5 7   4 9 9
            5           4 7   4   7   6 9 1
            9 0 5 4 4 4 3 1 5 9     7 9
                          7 9   7 4 3
              9 6 8 4 8 0 9   8 3   9
                                9 8 3
The first negative term is a(15) = -26, where 26 is the square spiral number of
(3,1) where the first digit of 16 is placed in the 15th move, the second digit being placed just below at (3,0), whence the - sign.
When 98 is placed at the bottom of the above grid, as well 983 as 739 must be prime.
Near this, note how 83 and earlier 73 were placed "sideways" adjacent to an already filled square. (83 with its 3 below the 7 of 74; 73 with its 7 "side by side" to the 9 of 769
Here all 2-digit numbers have been used, so we know that all "holes" of width/height <= 2 will remain empty forever.
		

Crossrefs

Cf. A174344, A268038 (= -A274923): x- and y-coordinate of cell with given square spiral number.

Programs

  • PARI
    \\ See Hasler link.
Previous Showing 11-14 of 14 results.