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
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.
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
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).
- Eric Angelini, Spirals for Scott, Blog entry, Oct. 19, 2022.
- Eric Angelini, Spirals for Scott, Blog entry, Oct. 19, 2022 [Local copy, with permission].
- M. F. Hasler, Plot of the knight's tour A357046, Oct 20 2022.
-
/* 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
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
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
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.
- Eric Angelini, Cross-My-Primes, personal blog cinquantesignes.blogspot.com, April 2020.
- M. F. Hasler, Prime scrabble (includes PARI programs), on google docs, May 2020.
Comments