OFFSET
1,2
LINKS
Robert Price, Table of n, a(n) for n = 1..10000
Wikipedia, Ulam spiral
EXAMPLE
For n=1:
+------------------------+
| 18 17 16 15 14 |
| +--------------+ |
| 19 | 6 5 4 | 13 |
| | +----+ | |
| 20 | 7 | 2 3 | 12 |
| | +---------+ |
| 21 | 8 9 10 11 |
| +-------------------+
| 22 23 24 25 26
+-------------------------
None of the four numbers located on the diagonals in NE, NW, SW or SE direction are prime, so a(1) = 0.
.
For n=2:
+----------------------------------+
| 39 38 37 36 35 34 33 |
| +------------------------+ |
| 40 | 19 18 17 16 15 | 32 |
| | +--------------+ | |
| 41 | 20 | 7 6 5 | 14 | 31 |
| | | +---+ | | |
| 42 | 21 | 8 | 3 4 | 13 | 30 |
| | | +--------+ | |
| 43 | 22 | 9 10 11 12 | 29 |
| | +-------------------+ |
| 44 | 23 24 25 26 27 28 |
| +-----------------------------+
| 45 46 47 48 49 50 51
+-----------------------------------
The encountered primes are 5 in NE direction, 7, 19, in NW direction and 11 in SE direction, so a(2) = 2.
.
For n=3:
+--------------------------------------------+
| 69 68 67 66 65 64 63 62 61 |
| +----------------------------------+ |
| 70 | 41 40 39 38 37 36 35 | 60 |
| | +------------------------+ | |
| 71 | 42 | 21 20 19 18 17 | 34 | 59 |
| | | +--------------+ | | |
| 72 | 43 | 22 | 9 8 7 | 16 | 33 | 58 |
| | | | +----+ | | | |
| 73 | 44 | 23 | 10 | 5 6 | 15 | 32 | 57 |
| | | | +---------+ | | |
| 74 | 45 | 24 | 11 12 13 14 | 31 | 56 |
| | | +-------------------+ | |
| 75 | 46 | 25 26 27 28 29 30 | 55 |
| | +-----------------------------+ |
| 76 | 47 48 49 50 51 52 53 54 |
| +---------------------------------------+
| 77 78 79 80 81 82 83 84 85
+---------------------------------------------
The encountered primes are 7, 17 in NE direction, 11 in SW direction and 13, 29, 53 in SE direction, so a(3) = 3.
CROSSREFS
KEYWORD
nonn
AUTHOR
Felix Fröhlich, Feb 05 2018
EXTENSIONS
Corrected a(3) and diagram for n=3. - Robert Price, Apr 02 2018
a(11)-a(85) from Robert Price, Apr 02 2018
STATUS
approved