

A260643


Start a spiral of numbers on a square grid, with the initial square as a(1) = 1. a(n) is the smallest positive integer not equal to or previously adjacent (horizontally/vertically) to its neighbors. See the Comments section for a more exact definition.


9



1, 2, 3, 4, 2, 5, 3, 6, 7, 1, 8, 7, 4, 8, 5, 6, 4, 9, 7, 10, 1, 9, 8, 11, 3, 12, 11, 10, 12, 13, 1, 12, 14, 9, 10, 14, 1, 15, 6, 13, 2, 16, 3, 17, 11, 13, 5, 14, 2, 11, 6, 14, 13, 9, 15, 18, 2, 19, 5, 15, 16, 4, 17, 20, 2, 21, 3, 18, 16, 17, 5, 20, 4, 19, 6
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


COMMENTS

A more detailed definition from Antti Karttunen, Dec 09 2015: (Start)
After a(1) = 1, for the next term always choose the smallest number k >= 1 such that neither k and a(n1) nor k and a(A265400(n)) [in case A265400(n) > 0] are equal, and neither of these pairs occur anywhere adjacent to each other (horizontally or vertically) in so far constructed spiral. Here A265400(n) gives the index of the nearest horizontally or vertically adjacent inner neighbor of the nth term in spiral, or 0 if n is one of the corner cases A033638.
The condition "... do not occur anywhere adjacent to each other (horizontally or vertically) in so far constructed spiral" can be more formally stated as: there is no such 1 < j < n, for which either the unordered pair {a(j),a(j1)} or [in case A265400(j) > 0] also the unordered pair {a(j),a(A265400(j))} would be equal to either of the unordered pair {k,a(n1)} or the unordered pair {k,a(A265400(n))} [in case A265400(n) > 0], where k is the term chosen for a(n). (See also my reference Schemeimplementation.)
(End)


LINKS

Peter Kagey, Table of n, a(n) for n = 1..10000
Antti Karttunen, R6RSScheme program for computing this sequence (with a naive algorithm)
Peter Kagey, Ruby program for computing this sequence.


EXAMPLE

a(8) = 6 because pairs {1,2}, {1,4} and {1,5} already occur, the immediately adjacent terms are 1 and 3, thus neither number can be used, so the smallest usable number is 6.
a(12) = 7 because 1 and 2 are already adjacent to 8; 2, 4, 5, and 6 are already adjacent to 3.
The following illustration is the timeline of spiral's construction stepbystep:
  3  43  243  243   243  243  2437
1  12  12  12  12  512   512  5128  5128
      ...  3671  3671  3671
        
a(1)=1a(2)=2a(3)=3a(4)=4a(5)=2a(6)=5 a(10)=1a(11)=8a(12)=7
Indices of this spiral are shown below using the base36 system, employing as its placeholder values the digits 09 and letter AZ. The 1 at the center is where the spiral starts:
ZYXWV
HGFEDU
I543CT
J612BS
K789AR
LMNOPQ


CROSSREFS

Cf. A033638, A123663, A265400, A265579.
Cf. A272573 (analogous sequence on a hexagonal tiling).
Cf. A265414 (positions of records, where n occurs for the first time), A265415 (positions of ones).
Sequence in context: A305829 A121701 A161759 * A300840 A243849 A286547
Adjacent sequences: A260640 A260641 A260642 * A260644 A260645 A260646


KEYWORD

nonn,look,hear


AUTHOR

Peter Kagey, Nov 11 2015


STATUS

approved



