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.
%I A332067 #27 Dec 19 2024 11:52:42 %S A332067 0,1,2,8,5,18,19,23,13,15,20,37,11,68,150,-26,44,70,-47,-114,53,-216, %T A332067 -35,-77,103,64,-32,61,31,146,-50,162,159,152,-80,-166,54,-154,-117, %U A332067 -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 %N 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. %C A332067 Inspired by Eric Angelini's "Cross my primes", cf. links. %C A332067 Starting with a 2 at the center, place at each move the smallest possible positive integer not used earlier, according to the following rules: %C A332067 (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. %C A332067 (2) At least one of these squares must be adjacent to a nonempty square. %C A332067 (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. %C A332067 (4) If the same (least) number can be placed in different ways, we choose according to 3 criteria in this order: %C A332067 (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. %C A332067 (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 A332067 (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. %C A332067 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). %C A332067 Almost all numbers are placed in their natural order, i.e., n at the n-th move. %C A332067 "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. %C A332067 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. %C A332067 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. %H A332067 Eric Angelini, <a href="https://cinquantesignes.blogspot.com/2020/04/cross-my-prime.html">Cross-My-Primes</a>, personal blog cinquantesignes.blogspot.com, April 2020. %H A332067 M. F. Hasler, <a href="https://docs.google.com/document/u/1/d/e/2PACX-1vSgmGKOr_veX5KmFZcfwnXLzKfruaMD0Ji1ZYyzJXgxVhhkFxEUMg6kgzr6UrupOq91jGx8r6q9Yft7/pub">Prime scrabble</a> (includes PARI programs), on google docs, May 2020. %e A332067 To the right we show the square spiral used for labeling 20 21 22 23 24... %e A332067 each position (x,y) of the grid with a nonnegative integer, 19 6--7--8--9 : %e A332067 cf. A268038. (Counterclockwise numbering would be equally 18 5 0--1 10 : %e A332067 possible, as would be diamond- or hexagonal or yet 17 4--3--2 11 : %e A332067 differently shaped spirals. The clockwise square spiral 16 15 14 13 12 : %e A332067 numbering happens to give the smallest a(2) = 2.) %e A332067 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. %e A332067 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. %e A332067 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: %e A332067 8 after 4 placed on (1,1): a(4) = 8 (producing prime 431), %e A332067 6 4 5 placed on (-1,0): a(5) = 5 (producing prime 523), %e A332067 7 5 2 3 7 placed on (-2,0): a(6) = 18 (producing prime 7523), %e A332067 1 6 placed on (-2,1): a(7) = 19 (producing prime 67), %e A332067 1 0 9 etc. (see below). %e A332067 There is no way to place 6 after a(5) = 5. %e A332067 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. %e A332067 At move 100 we have: %e A332067 1 %e A332067 0 %e A332067 0 %e A332067 4 %e A332067 6 8 8 7 %e A332067 8 2 7 5 5 4 6 %e A332067 2 0 2 6 0 6 %e A332067 6 8 6 4 4 2 3 2 2 3 3 3 2 %e A332067 6 6 2 3 4 5 %e A332067 9 2 8 8 5 6 3 7 4 3 0 2 9 3 5 8 %e A332067 8 0 1 7 4 1 6 5 5 %e A332067 7 6 4 5 3 5 1 8 1 1 8 9 3 2 7 %e A332067 6 4 1 1 5 1 8 %e A332067 7 5 5 8 1 4 1 5 7 5 2 3 6 5 7 7 %e A332067 9 8 4 1 1 1 3 2 1 3 8 %e A332067 7 9 2 5 1 2 1 0 9 3 7 1 %e A332067 8 6 7 0 6 6 6 1 2 2 2 9 9 %e A332067 9 3 0 2 6 3 2 8 7 4 5 7 4 9 9 %e A332067 5 4 7 4 7 6 9 1 %e A332067 9 0 5 4 4 4 3 1 5 9 7 9 %e A332067 7 9 7 4 3 %e A332067 9 6 8 4 8 0 9 8 3 9 %e A332067 9 8 3 %e A332067 The first negative term is a(15) = -26, where 26 is the square spiral number of %e A332067 (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. %e A332067 When 98 is placed at the bottom of the above grid, as well 983 as 739 must be prime. %e A332067 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 %e A332067 Here all 2-digit numbers have been used, so we know that all "holes" of width/height <= 2 will remain empty forever. %o A332067 (PARI) \\ See Hasler link. %Y A332067 Cf. A174344, A268038 (= -A274923): x- and y-coordinate of cell with given square spiral number. %K A332067 sign,base %O A332067 0,3 %A A332067 _M. F. Hasler_ and _Eric Angelini_, May 05 2020