cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A366311 Lexicographically earliest sequence of positive integers on a square spiral such that there are no palindromes with length > 2 in any row, column or diagonal.

This page as a plain text file.
%I A366311 #25 Jan 06 2025 22:07:38
%S A366311 1,1,1,1,2,2,3,2,4,3,3,4,2,3,4,4,2,3,3,4,2,3,4,4,2,2,2,5,3,2,2,2,4,5,
%T A366311 3,2,4,1,1,5,4,1,1,1,5,5,6,1,1,2,1,5,4,1,1,3,3,1,5,5,3,2,1,3,3,1,4,5,
%U A366311 1,2,4,3,1,2,3,5,1,1,3,3,4,1,3,6,4,1,1
%N A366311 Lexicographically earliest sequence of positive integers on a square spiral such that there are no palindromes with length > 2 in any row, column or diagonal.
%C A366311 The maximum value the sequence can reach is 9 (and which occurs first at n = A366312(9)).
%C A366311 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.
%H A366311 Samuel Harkness, <a href="/A366311/b366311.txt">Table of n, a(n) for n = 1..10000</a>
%H A366311 Samuel Harkness, <a href="/A366311/a366311.m.txt">MATLAB program</a>
%e A366311 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.
%e A366311 .
%e A366311    4    2    3    5    4    2    2
%e A366311    1    2    4    4    3    2    2
%e A366311    1    3    2    1    1    4    3
%e A366311    5    3    2    1    1    3    5
%e A366311    4    4    3    2    4    3    2
%e A366311    1    2    3    4    4    2    2
%e A366311    1    1  a(45)
%e A366311 .
%e A366311 The first 144 terms:
%e A366311   4---2---1---4---6---2---4---1---3---2---2---1
%e A366311                                               |
%e A366311   2---4---1---3---2---4---1---1---3---4---1   1
%e A366311   |                                       |   |
%e A366311   2   3---3---1---2---3---5---5---1---3   4   4
%e A366311   |   |                               |   |   |
%e A366311   3   1   4---2---3---5---4---2---2   3   4   5
%e A366311   |   |   |                       |   |   |   |
%e A366311   6   4   1   2---4---4---3---2   2   1   3   2
%e A366311   |   |   |   |               |   |   |   |   |
%e A366311   2   5   1   3   2---1---1   4   3   1   1   2
%e A366311   |   |   |   |   |       |   |   |   |   |   |
%e A366311   2   1   5   3   2   1---1   3   5   4   1   3
%e A366311   |   |   |   |   |           |   |   |   |   |
%e A366311   3   2   4   4   3---2---4---3   2   5   4   3
%e A366311   |   |   |   |                   |   |   |   |
%e A366311   3   4   1   2---3---4---4---2---2   1   6   5
%e A366311   |   |   |                           |   |   |
%e A366311   5   3   1---1---5---5---6---1---1---2   3   4
%e A366311   |   |                                   |   |
%e A366311   4   1---2---3---5---1---1---3---3---4---1   2
%e A366311   |                                           |
%e A366311   3---2---2---6---4---3---2---4---4---3---2---1
%e A366311 .
%o A366311 (MATLAB) % See Harkness link.
%Y A366311 Cf. A355271, A366312 (indices of first occurrence of n).
%Y A366311 Cf. A174344, A274923 (spiral coordinates).
%K A366311 nonn
%O A366311 1,5
%A A366311 _Samuel Harkness_, Oct 06 2023