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.

A326409 Minesweeper sequence of positive integers arranged on a 2D grid along Hamiltonian path.

This page as a plain text file.
%I A326409 #25 Jan 25 2024 14:31:22
%S A326409 2,-1,-1,3,-1,3,-1,3,4,2,-1,3,-1,3,3,2,-1,4,-1,2,2,1,-1,2,3,1,1,2,-1,
%T A326409 3,-1,3,3,2,3,2,-1,1,2,2,-1,2,-1,2,2,2,-1,1,1,0,1,2,-1,2,3,1,2,2,-1,2,
%U A326409 -1,1,1,1,1,2,-1,1,2,1,-1,3,-1,2,2,1,2,3,-1,1
%N A326409 Minesweeper sequence of positive integers arranged on a 2D grid along Hamiltonian path.
%C A326409 Place positive integers on a 2D grid starting with 1 in the top left corner and continue along Hamiltonian path A163361 or A163363.
%C A326409 Replace each prime with -1 and each nonprime by the number of primes in adjacent grid cells around it.
%C A326409 n is replaced by a(n).
%C A326409 This sequence treats prime numbers as "mines" and fills gaps according to rules of the classic Minesweeper game.
%C A326409 a(n) < 5.
%C A326409 Set of n such that a(n) = 4 is unbounded (conjectured).
%H A326409 Alexander Bogomolny, <a href="https://www.cut-the-knot.org/Curriculum/Geometry/PlaneFillingCurves.shtml">Plane Filling Curves: Hilbert's & Moore's</a>, Cut the Knot.org, retrieved October 2019.
%H A326409 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/HilbertCurve.html">Hilbert Curve</a>.
%H A326409 Wikipedia, <a href="https://en.wikipedia.org/wiki/Hilbert_curve">Hilbert Curve</a>.
%H A326409 Wikipedia, <a href="https://en.wikipedia.org/wiki/Minesweeper_(video_game)">Minesweeper game</a>.
%e A326409 Consider positive integers distributed onto the plane along an increasing Hamiltonian path (in this case it starts downwards):
%e A326409 .
%e A326409    1   4---5---6  59--60--61  64--...
%e A326409    |   |       |   |       |   |
%e A326409    2---3   8---7  58--57  62--63
%e A326409            |           |
%e A326409   15--14   9--10  55--56  51--50
%e A326409    |   |       |   |       |   |
%e A326409   16  13--12--11  54--53--52  49
%e A326409    |                           |
%e A326409   17--18  31--32--33--34  47--48
%e A326409        |   |           |   |
%e A326409   20--19  30--29  36--35  46--45
%e A326409    |           |   |           |
%e A326409   21  24--25  28  37  40--41  44
%e A326409    |   |   |   |   |   |   |   |
%e A326409   22--23  26--27  38--39  42--43
%e A326409 .
%e A326409 1 is not prime and in adjacent grid cells there are 2 primes: 2 and 3. Therefore a(1) = 2.
%e A326409 2 is prime, therefore a(2) = -1.
%e A326409 8 is not prime and in adjacent grid cells there are 3 primes: 5, 3 and 7. Therefore a(8) = 3.
%e A326409 Replacing n with a(n) in the plane described above, and using "." for a(n) = 0 and "*" for negative a(n), we produce a graph resembling Minesweeper, where the mines are situated at prime n:
%e A326409   2   3---*---3   *---2---*   1 ...
%e A326409   |   |       |   |       |   |
%e A326409   *---*   3---*   2---2   1---1
%e A326409           |           |
%e A326409   3---3   4---2   3---1   1---.
%e A326409   |   |       |   |       |   |
%e A326409   2   *---3---*   2---*---2   1
%e A326409   |                           |
%e A326409   *---4   *---3---3---2   *---1
%e A326409       |   |           |   |
%e A326409   2---*   3---*   2---3   2---2
%e A326409   |           |   |           |
%e A326409   2   2---3   2   *   2---*   2
%e A326409   |   |   |   |   |   |   |   |
%e A326409   1---*   1---1   1---2   2---*
%e A326409 In order to produce the sequence, the graph is read along its original mapping.
%t A326409 Block[{nn = 4, s, t, u}, s = ConstantArray[0, {2^#, 2^#}] &[nn + 1]; t = First[HilbertCurve@ # /. Line -> List] &[nn + 1] &[nn + 1]; s = ArrayPad[ReplacePart[s, Array[{1, 1} + t[[#]] -> # &, 2^(2 (nn + 1))]], {{1, 0}, {1, 0}}]; u = Table[If[PrimeQ@ m, -1, Count[#, _?PrimeQ] &@ Union@ Map[s[[#1, #2]] & @@ # &, Join @@ Array[FirstPosition[s, m] + {##} - 2 &, {3, 3}]]], {m, (2^nn)^2}]]
%Y A326409 Cf. A163361 (plane mapping), A163363 (alternative plane mapping).
%Y A326409 Different arrangements of integers: A326405 (antidiagonals), A326406 (triangle maze), A326407 (square mapping), A326408 (square maze), A326410 (Ulam's spiral).
%K A326409 sign,tabl
%O A326409 1,1
%A A326409 _Witold Tatkiewicz_, Oct 07 2019