A299207 Length of longest run of primes in any of the four diagonals starting from the center of a square number spiral with prime(n) at the center.
0, 2, 3, 6, 5, 2, 8, 1, 4, 3, 1, 8, 20, 4, 3, 2, 13, 1, 7, 4, 1, 1, 2, 3, 2, 7, 1, 4, 1, 0, 1, 3, 6, 0, 7, 1, 1, 19, 1, 2, 2, 0, 4, 1, 1, 0, 0, 2, 8, 1, 12, 3, 0, 3, 2, 2, 5, 1, 3, 4, 0, 0, 1, 7, 1, 0, 1, 0, 8, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 0, 3, 0, 7, 1, 1
Offset: 1
Keywords
Examples
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.
Links
- Robert Price, Table of n, a(n) for n = 1..10000
- Wikipedia, Ulam spiral
- Index entries for sequences related to spirals
Crossrefs
Cf. A215471.
Extensions
Corrected a(3) and diagram for n=3. - Robert Price, Apr 02 2018
a(11)-a(85) from Robert Price, Apr 02 2018
Comments