%I #16 Apr 25 2023 01:02:05
%S 1,1,1,1,2,2,3,2,4,3,3,4,2,3,4,4,5,3,2,5,4,3,5,4,2,2,3,5,2,2,4,2,3,5,
%T 4,6,3,1,1,5,5,4,1,1,6,6,2,5,6,4,5,1,1,6,4,7,5,4,1,5,3,6,2,3,1,1,3,7,
%U 6,2,7,4,5,7,3,6,1,1,4,3,1,5,2,1,1,6,5,7,1,5,3,3,5,1,1,3,7,4,6
%N Lexicographically earliest sequence of positive integers on a square spiral such that the product of adjacent pairs of numbers within each row, column and diagonal is distinct in that row, column and diagonal.
%C In the first 2 million terms the largest number is 257, while the number 37, the most commonly occurring number, appears 43477 times. Prime numbers appear more often than the composites. See the linked images.
%H Scott R. Shannon, <a href="/A355271/a355271.png">Image of the first 2 million terms</a>. The values are scaled across the spectrum from red to violet, with the value ranges increasing towards the violet end to give more color weighting to the larger numbers.
%H Scott R. Shannon, <a href="/A355271/a355271_1.png">Distribution of a(n) for the first 2 million terms</a>. The number 37, the most commonly occurring number, appears 43477 times. The prime numbers are shown in yellow, nonprimes in white.
%e The spiral begins:
%e .
%e .
%e 3---6---4---5---3---2---4 :
%e | | :
%e 1 5---4---4---3---2 2 4
%e | | | | |
%e 1 3 2---1---1 4 2 6
%e | | | | | | |
%e 5 2 2 1---1 3 5 1
%e | | | | | |
%e 5 5 3---2---4---3 3 1
%e | | | |
%e 4 4---3---5---4---2---2 5
%e | |
%e 1---1---6---6---2---5---6---4
%e .
%e a(25) = 2 as when a(25) is placed, at coordinate (2,-2) relative to the starting square, its adjacent squares are a(10) = 3, a(9) = 4, a(24) = 4. The products of adjacent pairs of numbers in a(25)'s column are 3 * 3 = 9, 3 * 4 = 12, 4 * 2 = 8, in its north-west diagonal are 4 * 1 = 4, 1 * 2 = 2, 2 * 5 = 10, and in its row are 4 * 5 = 20, 5 * 3 = 15, 3 * 4 = 12. Setting a(25) to 1 would create a product of 4 with its diagonal neighbor 4, but 4 has already occurred as a product on this diagonal. Similarly numbers 3, 4 and 5 would not be possible as they would create products with the three adjacent numbers, 3, 4, and 4, which have already occurred along the corresponding column, diagonal or row. But 2 is smaller and creates new products, namely 6, 8 and 8, with its three neighbors that have not already occurred along the corresponding column, diagonal and row.
%Y Cf. A355270, A274640, A275609, A307834.
%K nonn
%O 1,5
%A _Scott R. Shannon_, Jun 26 2022