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.

A326406 Minesweeper sequence of positive integers arranged on a 2D grid along a triangular maze.

This page as a plain text file.
%I A326406 #34 Jul 12 2025 08:37:09
%S A326406 3,-1,-1,2,-1,3,-1,4,4,1,-1,3,-1,3,2,1,-1,3,-1,3,2,1,-1,2,3,2,3,1,-1,
%T A326406 3,-1,2,2,1,2,1,-1,2,3,1,-1,3,-1,3,2,1,-1,2,3,2,3,2,-1,2,1,0,1,2,-1,3,
%U A326406 -1,2,2,1,2,1,-1,2,2,1,-1,3,-1,3,4,0,1,1
%N A326406 Minesweeper sequence of positive integers arranged on a 2D grid along a triangular maze.
%C A326406 Write positive integers on a 2D grid starting with 1 in the top left corner and continue along the triangular maze as in A056023.
%C A326406 Replace each prime with -1 and each nonprime with the number of primes in adjacent grid cells around it.
%C A326406 n is replaced by a(n).
%C A326406 This sequence treats prime numbers as "mines" and fills gaps according to the rules of the classic Minesweeper game.
%C A326406 a(n) < 5 (conjectured).
%C A326406 Set of n such that a(n) = 4 is unbounded (conjectured).
%H A326406 Michael De Vlieger, <a href="/A326406/b326406.txt">Table of n, a(n) for n = 1..11325</a> (150 antidiagonals).
%H A326406 Michael De Vlieger, <a href="/A326406/a326406.png">Minesweeper-style graph</a> read along original mapping, replacing -1 with a "mine", and 0 with blank space.
%H A326406 Michael De Vlieger, <a href="/A326406/a326406_1.png">Square plot of a million terms</a> read along original mapping, with black indicating a prime and levels of gray commensurate to a(n).
%H A326406 Witold Tatkiewicz, <a href="https://pastebin.com/1auXQnuZ">Java program</a>
%H A326406 Wikipedia, <a href="https://en.wikipedia.org/wiki/Minesweeper_(video_game)">Minesweeper game</a>
%e A326406 Consider positive integers placed on the plane along a triangular maze:
%e A326406    1  2  6  7 15 16 ...
%e A326406    3  5  8 14 17 ...
%e A326406    4  9 13 18 ...
%e A326406   10 12 19 ...
%e A326406   11 20 ...
%e A326406   21 ...
%e A326406   ...
%e A326406 1 is not prime and in adjacent grid cells there are 3 primes: 2, 3 and 5. Therefore a(1) = 3.
%e A326406 2 is prime, therefore a(2) = -1.
%e A326406 8 is not prime and in adjacent grid cells there are 4 primes: 2, 5, 7 and 13. Therefore a(8) = 4.
%e A326406 Replacing n by 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 A326406   3  *  3  *  2  1  1  *  2  1  1  * ...
%e A326406   *  *  4  3  *  3  3  3  *  2  2  2
%e A326406   2  4  *  3  2  *  *  2  1  2  *  1
%e A326406   1  3  *  3  2  3  3  2  1  1  1  2
%e A326406   *  3  2  2  *  2  2  *  2  1  .  1
%e A326406   2  *  1  1  3  *  3  2  *  2  1  1
%e A326406   1  2  3  2  3  *  3  2  3  *  1  .
%e A326406   1  2  *  *  3  2  2  *  2  1  2  2
%e A326406   *  2  2  4  *  2  1  2  3  2  2  *
%e A326406   1  1  .  2  *  3  1  1  *  *  2  3
%e A326406   .  1  2  3  3  *  2  2  3  2  1  1
%e A326406   1  2  *  *  2  1  2  *  1  .  .  1
%e A326406 ...
%e A326406 In order to produce sequence graph is read along original mapping.
%t A326406 Block[{n = 12, s}, s = ArrayPad[Array[If[OddQ[#1 + #2], 1 + PolygonalNumber[#1 + #2 - 1] - #2, PolygonalNumber[#1 + #2 - 2] + #2] &, {# + 1, # + 1}], 1] &@ n; Table[If[PrimeQ@ m, -1, Count[#, _?PrimeQ] &@ Union@ Map[s[[#1, #2]] & @@ # &, Join @@ Array[FirstPosition[s, m] + {##} - 2 &, {3, 3}]]], {m, PolygonalNumber@ n}]] (* _Michael De Vlieger_, Oct 02 2019 *)
%o A326406 (Java) // See Links section.
%Y A326406 Cf. A056023 - plane mapping
%Y A326406 Different arrangements of integers:
%Y A326406 Cf. A326405 - antidiagonals,
%Y A326406 Cf. A326407 - square mapping,
%Y A326406 Cf. A326408 - square maze,
%Y A326406 Cf. A326409 - Hamiltonian path,
%Y A326406 Cf. A326410 - Ulam's spiral.
%K A326406 sign,tabl
%O A326406 1,1
%A A326406 _Witold Tatkiewicz_, Oct 02 2019