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.

Showing 1-2 of 2 results.

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.

Original entry on oeis.org

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
Offset: 1

Views

Author

Peter Kagey, Nov 11 2015

Keywords

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(n-1) 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 n-th 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(j-1)} 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(n-1)} 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 Scheme-implementation.)
(End)

Examples

			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 step-by-step:
        |      |   3  |  43  | 243  | 243  |     |  243  |  243  |  2437
    1   |  12  |  12  |  12  |  12  | 512  |     |  512  |  5128 |  5128
        |      |      |      |      |      | ... |  3671 |  3671 |  3671
        |      |      |      |      |      |     |       |       |
  a(1)=1|a(2)=2|a(3)=3|a(4)=4|a(5)=2|a(6)=5|     |a(10)=1|a(11)=8|a(12)=7
Indices of this spiral are shown below using the base-36 system, employing as its placeholder values the digits 0-9 and letter A-Z. The 1 at the center is where the spiral starts:
            ZYXWV
           HGFEDU
           I543CT
           J612BS
           K789AR
           LMNOPQ
		

Crossrefs

Cf. A272573 (analogous sequence on a hexagonal tiling).
Cf. A265414 (positions of records, where n occurs for the first time), A265415 (positions of ones).

A265410 a(n) = one-based index to the nearest horizontally or vertically adjacent inner neighbor in square-grid spirals, and to the nearest diagonally adjacent inner neighbor when n is one of the corner cases A033638.

Original entry on oeis.org

0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 5, 5, 5, 6, 7, 7, 7, 8, 9, 10, 10, 10, 11, 12, 13, 13, 13, 14, 15, 16, 17, 17, 17, 18, 19, 20, 21, 21, 21, 22, 23, 24, 25, 26, 26, 26, 27, 28, 29, 30, 31, 31, 31, 32, 33, 34, 35, 36, 37, 37, 37, 38, 39, 40, 41, 42, 43, 43, 43, 44, 45, 46, 47, 48, 49, 50, 50, 50, 51, 52, 53, 54, 55, 56, 57, 57, 57, 58, 59, 60, 61, 62, 63, 64, 65, 65
Offset: 1

Views

Author

Antti Karttunen, Dec 09 2015

Keywords

Comments

By convention: a(1) = 0 because as 1 is a starting point of such spirals, it has no "inner neighbors" for itself.
Each n occurs A265411(n) times.

Examples

			We arrange natural numbers as a counterclockwise spiral into the square grid in the following manner (here A stands for 10, B for 11 and C for 12). The first square corresponds with n, and the second square with the value of a(n):
                    55433
            543C    51113C
            612B    61012B
            789A    71122A
                    7789AA
-
For each n > 1, we look for the nearest horizontally or vertically adjacent neighbor of n towards the center that is not n-1, which will then be value of a(n) [e.g., it is 1 for 4, 6 and 8, while it is 2 for 9 and 11 and 3 for 12] unless n is in the corner (one of the terms of A033638), in which case the value is the nearest diagonally adjacent neighbor towards the center.
		

Crossrefs

One more than A265409(n-1).
Cf. A265400 (a variant).
Cf. A265411, A265412, A265413 (positions of records, i.e., where value increases).

Formula

a(1) = 0; for 1 < n < 8, a(n) = 1 and for n >= 8: if either A240025(n-1) or A240025(n-2) is not zero [when n or n-1 is in A033638], then a(n) = a(n-1), otherwise, a(n) = 1 + a(n-1).
a(1) = 0; for 1 < n < 8, a(n) = 1 and for n >= 8: a(n) = a(n-1) + (1-A240025(n-1))*(1-A240025(n-2)). [The same formula in a more compact form.]
Other identities. For all n >= 0:
a(A265413(n)) = n. [Sequence is the least monotonic left inverse of A265413.]
a(A265412(n)) = n. [Also inverse of A265412.]
Showing 1-2 of 2 results.