OFFSET
1,5
COMMENTS
The maximum value the sequence can reach is 9 (and which occurs first at n = A366312(9)).
Proof: When a new a(n) is being chosen, the most possible directions away from a(n) which have been filled is 4. Without loss of generality, say the spiral is on the left moving downward. The possible directions that can be blocked are north, northeast, east, and southeast. Consider the nearest cells in a particular direction to be "A B C p" where p = a(n) is to be determined. Then p != B, and if B=C then p != A too. Note if the nearest cells in a particular direction would create a palindrome > length 4, then a smaller palindrome > length 2 must be nested inside, which is a contradiction. Therefore, there are 4 possible directions that can lead to values being blocked, and in each direction 2 values can be blocked, so at most 4*2=8 values can be blocked. If all 8 values are blocked, this gives 9 as the maximum possible value which could be reached.
LINKS
Samuel Harkness, Table of n, a(n) for n = 1..10000
Samuel Harkness, MATLAB program
EXAMPLE
For a(45), first consider the west direction. The nearest cells are "1 1", so a(45) cannot be 1, as this would create "1 1 1". Next, consider the northwest direction. The nearest cells are "2 4", so a(45) cannot be 4, as this would create "4 2 4". Then, consider the north direction. From the Proof above only the 3 nearest cells need to be considered (unless the two closest are unequal, in which case only the 2 nearest). The nearest cells are "3 3 2", so a(45) cannot be 3, as this would create "3 3 3", and a(45) cannot be 2, as this would create "2 3 3 2". Last, consider the northeast direction. The nearest cells are "4 4 3", so a(45) cannot be 4 or 3, as we already know. Thus, a(45) cannot be 1, 2, 3, or 4, so a(45)=5.
.
4 2 3 5 4 2 2
1 2 4 4 3 2 2
1 3 2 1 1 4 3
5 3 2 1 1 3 5
4 4 3 2 4 3 2
1 2 3 4 4 2 2
1 1 a(45)
.
The first 144 terms:
4---2---1---4---6---2---4---1---3---2---2---1
|
2---4---1---3---2---4---1---1---3---4---1 1
| | |
2 3---3---1---2---3---5---5---1---3 4 4
| | | | |
3 1 4---2---3---5---4---2---2 3 4 5
| | | | | | |
6 4 1 2---4---4---3---2 2 1 3 2
| | | | | | | | |
2 5 1 3 2---1---1 4 3 1 1 2
| | | | | | | | | | |
2 1 5 3 2 1---1 3 5 4 1 3
| | | | | | | | | |
3 2 4 4 3---2---4---3 2 5 4 3
| | | | | | | |
3 4 1 2---3---4---4---2---2 1 6 5
| | | | | |
5 3 1---1---5---5---6---1---1---2 3 4
| | | |
4 1---2---3---5---1---1---3---3---4---1 2
| |
3---2---2---6---4---3---2---4---4---3---2---1
.
PROG
(MATLAB) See Links section.
CROSSREFS
KEYWORD
nonn
AUTHOR
Samuel Harkness, Oct 06 2023
STATUS
approved