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.

A326407 Minesweeper sequence of positive integers arranged on a 2D grid along a square array that grows by alternately adding a row at its bottom edge and a column at its right edge.

This page as a plain text file.
%I A326407 #27 Mar 20 2020 22:54:18
%S A326407 2,-1,-1,2,-1,5,-1,2,1,3,-1,4,-1,3,2,0,-1,3,-1,3,3,2,-1,1,0,2,3,2,-1,
%T A326407 3,-1,1,2,2,2,0,-1,1,2,3,-1,3,-1,3,3,2,-1,1,0,1,2,2,-1,2,3,2,3,2,-1,2,
%U A326407 -1,3,2,0,1,2,-1,2,1,1,-1,3,-1,1,1,1,3,3,-1,1,0
%N A326407 Minesweeper sequence of positive integers arranged on a 2D grid along a square array that grows by alternately adding a row at its bottom edge and a column at its right edge.
%C A326407 Place positive integers on a 2D grid starting with 1 in the top left corner and continue along an increasing square array as in A060734.
%C A326407 Replace each prime with -1 and each nonprime with the number of primes in adjacent grid cells around them.
%C A326407 n is replaced by a(n).
%C A326407 This sequence treats prime numbers as "mines" and fills gaps according to the rules of the classic Minesweeper game.
%C A326407 a(n) < 6 (conjectured).
%C A326407 a(n) = 5 for n={6} (conjectured).
%C A326407 Set of n such that a(n) = 4 is unbounded (conjectured).
%H A326407 Michael De Vlieger, <a href="/A326407/b326407.txt">Table of n, a(n) for n = 1..10000</a>
%H A326407 Michael De Vlieger, <a href="/A326407/a326407.png">Minesweeper-style graph</a> read along original mapping, replacing -1 with a "mine", and 0 with blank space.
%H A326407 Michael De Vlieger, <a href="/A326407/a326407_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 A326407 Witold Tatkiewicz, <a href="https://pastebin.com/SvHPVVvp">link for Java program</a>
%H A326407 Wikipedia, <a href="https://en.wikipedia.org/wiki/Minesweeper_(video_game)">Minesweeper game</a>
%e A326407 Consider positive integers distributed onto the plane along an increasing square array:
%e A326407    1  4  9 16 25 36
%e A326407    2  3  8 15 24 35
%e A326407    5  6  7 14 23 34
%e A326407   10 11 12 13 22 33
%e A326407   17 18 19 20 21 32
%e A326407   26 27 28 29 30 31
%e A326407 ...
%e A326407 1 is not prime and in adjacent grid cells there are 2 primes: 2 and 3. Therefore a(1) = 2.
%e A326407 2 is prime, therefore a(2) = -1.
%e A326407 8 is not prime and in adjacent grid cells there are 2 primes: 3, and 7. Therefore a(8) = 2.
%e A326407 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 A326407   2  2  1  .  .  .  .  .  .  .  .  . ...
%e A326407   *  *  2  2  1  2  1  2  1  1  .  1
%e A326407   *  5  *  3  *  2  *  3  *  2  1  1
%e A326407   3  *  4  *  2  2  2  *  3  *  1  1
%e A326407   *  3  *  3  3  1  3  2  3  1  2  1
%e A326407   2  3  2  *  3  *  3  *  1  .  1  *
%e A326407   *  1  2  3  *  3  *  2  1  .  2  3
%e A326407   1  2  2  *  2  3  2  3  1  2  2  *
%e A326407   1  2  *  2  1  1  *  3  *  2  *  2
%e A326407   2  *  3  2  .  2  3  *  3  3  1  1
%e A326407   *  3  *  1  1  2  *  3  *  2  1  .
%e A326407   1  2  1  2  2  *  3  3  2  *  1  1
%e A326407 ...
%e A326407 In order to produce the sequence, the graph is read along the original mapping.
%t A326407 Block[{n = 12, s}, s = ArrayPad[Array[If[#1 < 2 #2 - 1, #2^2 + #2 - #1, (#1 - #2)^2 + #2] & @@ {#1 + #2 - 1, #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 A326407 (Java) See Links section.
%Y A326407 Cf. A060734 - plane mapping
%Y A326407 Different arrangements of integers:
%Y A326407 Cf. A326405 - antidiagonals,
%Y A326407 Cf. A326406 - triangle maze,
%Y A326407 Cf. A326408 - square maze,
%Y A326407 Cf. A326409 - Hamiltonian path,
%Y A326407 Cf. A326410 - Ulam's spiral.
%K A326407 sign,tabl
%O A326407 1,1
%A A326407 _Witold Tatkiewicz_, Oct 02 2019