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-1 of 1 results.

A383191 a(n) is the number on the n-th position on the square spiral on the plane tiled with dominoes always placed nearest to the origin and so that no two dominos share a long side. Inverse permutation of A383190.

Original entry on oeis.org

0, 1, 8, 2, 3, 4, 5, 6, 10, 11, 12, 9, 26, 15, 14, 18, 19, 17, 16, 20, 21, 22, 7, 24, 28, 29, 42, 13, 36, 27, 66, 39, 38, 30, 31, 44, 45, 41, 40, 32, 33, 46, 47, 48, 23, 34, 25, 50, 68, 69, 76, 43, 52, 37, 70, 67, 108, 73, 72, 55, 54, 58, 59, 80, 81, 75, 74, 57, 56, 60, 61, 84, 85, 86, 49, 62
Offset: 0

Views

Author

M. F. Hasler, Apr 18 2025

Keywords

Comments

Each domino is represented by two consecutive integers (2k, 2k+1): (0, 1), (2, 3), etc.
"Nearest to the origin" means that one end of the domino (i.e., the number 2k) is placed on the free grid point nearest to the origin for the Euclidean distance, and in case of a tie, the earliest in counter-clockwise sense, starting to the right. (I.e., on the complex plane, the lexico-earliest (|z|, arg z) with 0 <= arg z < tau = 6.283185...) The other end of the domino will be placed on a free grid point to the north, south, east or west of the first end, also nearest possible to the origin, but so that the domino is not side-by-side sharing a long side with another domino.
The sequence is obtained by reading these integers along the plane filling square spiral starting at the origin, then one step to the right, then one step up, etc.
This sequence is a permutation of the nonnegative integers. The inverse permutation A383190 is obtained if to each number "filled in" we associate the square spiral number corresponding to its position on the grid. See A316328 (and also A174344) for an illustration of the square spiral numbers.

Examples

			The first domino (0, 1) is placed on the origin and the square to its right.
The second domino (2, 3) is placed above the origin (nearest free point coming first counter-clockwise), oriented to the left (since going to the right would place it side-by-side with the first domino, which is forbidden).
Then the third domino (4, 5) is placed left to the origin, going downwards (using the free point closest to the origin).
The fourth domino (6, 7) is placed below the origin, going downwards (since going to the right would make it parallel to the first domino).
Then the free points nearest to the origin are to its lower right and to its upper right. The upper right is preferred since it comes first counter-clockwise (starting to the right). The domino (8, 9) is placed sidewards, again because the other end upwards) would come later in counter-clockwise sense.
Then the domino (10, 11) is placed to the lower right, also sideways because vertically it would be side-by-side with (6, 7).
The first 16 dominoes are placed as follows, where the numbers (2n-2, 2n-1) represent the two ends of the n-th domino:
|
|    19==18  14==15  26==27
|
|    17   3===2   8===9
|    ||
|    16   4   0===1  12==13       The sequence is obtained by reading the numbers
|         ‖                       along the square spiral: starting at the origin
|    20   5   6  10==11           (0), go 1 right (1), 1 up (8), 2 left (2 and 3),
|    ||       ‖                   2 down (4 and 5), 3 right (6, 10, 11), 3 up
|    21  22   7  24  28==29       (12, 9, 26) 4 left (15, 14, 18, 19), etc.
|        ||      ||
|        23      25
|
We see that all dominoes in the upper right half plane are placed horizontally, and in the lower left half they are placed "vertically".
		

Crossrefs

Cf. A383190 (inverse permutation), A316328 (knight tour with illustration of square spiral), A174344 (square spiral, but clockwise), A316667 (square spiral starting with 1).

Programs

  • Python
    class A383191(A383190): # use A383191(n) or a=A383191(); a(n); a[m:n]; print(a)
        def _call_(self, n: int) -> int:
            "Return A383191(n)."
            if isinstance(n, int) and n >= 0:
                while n not in self.terms: self.extend()
                return self.terms.index(n) # this is the inverse permutation of 'terms'
            if n is None: return self # because A383191() => A383190(n=None) => a(n)
            raise ValueError(f"Expected non-negative index n, got {n = !r}.")
    A383191()[:50]   # list [a(0) .. a(49)]
    print(A383191()) # displays the grid filled so far (same as A383190)
Showing 1-1 of 1 results.