A326406 Minesweeper sequence of positive integers arranged on a 2D grid along a triangular maze.
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, 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, -1, 2, 2, 1, 2, 1, -1, 2, 2, 1, -1, 3, -1, 3, 4, 0, 1, 1
Offset: 1
Examples
Consider positive integers placed on the plane along a triangular maze: 1 2 6 7 15 16 ... 3 5 8 14 17 ... 4 9 13 18 ... 10 12 19 ... 11 20 ... 21 ... ... 1 is not prime and in adjacent grid cells there are 3 primes: 2, 3 and 5. Therefore a(1) = 3. 2 is prime, therefore a(2) = -1. 8 is not prime and in adjacent grid cells there are 4 primes: 2, 5, 7 and 13. Therefore a(8) = 4. 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: 3 * 3 * 2 1 1 * 2 1 1 * ... * * 4 3 * 3 3 3 * 2 2 2 2 4 * 3 2 * * 2 1 2 * 1 1 3 * 3 2 3 3 2 1 1 1 2 * 3 2 2 * 2 2 * 2 1 . 1 2 * 1 1 3 * 3 2 * 2 1 1 1 2 3 2 3 * 3 2 3 * 1 . 1 2 * * 3 2 2 * 2 1 2 2 * 2 2 4 * 2 1 2 3 2 2 * 1 1 . 2 * 3 1 1 * * 2 3 . 1 2 3 3 * 2 2 3 2 1 1 1 2 * * 2 1 2 * 1 . . 1 ... In order to produce sequence graph is read along original mapping.
Links
- Michael De Vlieger, Table of n, a(n) for n = 1..11325 (150 antidiagonals).
- Michael De Vlieger, Minesweeper-style graph read along original mapping, replacing -1 with a "mine", and 0 with blank space.
- Michael De Vlieger, Square plot of a million terms read along original mapping, with black indicating a prime and levels of gray commensurate to a(n).
- Witold Tatkiewicz, Java program
- Wikipedia, Minesweeper game
Crossrefs
Programs
-
Java
// See Links section.
-
Mathematica
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 *)
Comments