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.

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.

This page as a plain text file.
%I A383191 #13 Apr 23 2025 10:35:36
%S A383191 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,
%T A383191 42,13,36,27,66,39,38,30,31,44,45,41,40,32,33,46,47,48,23,34,25,50,68,
%U A383191 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
%N 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.
%C A383191 Each domino is represented by two consecutive integers (2k, 2k+1): (0, 1), (2, 3), etc.
%C A383191 "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.
%C A383191 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.
%C A383191 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.
%H A383191 <a href="/index/Do#domino">OEIS Index of sequences related to dominoes</a>
%e A383191 The first domino (0, 1) is placed on the origin and the square to its right.
%e A383191 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).
%e A383191 Then the third domino (4, 5) is placed left to the origin, going downwards (using the free point closest to the origin).
%e A383191 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).
%e A383191 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.
%e A383191 Then the domino (10, 11) is placed to the lower right, also sideways because vertically it would be side-by-side with (6, 7).
%e A383191 The first 16 dominoes are placed as follows, where the numbers (2n-2, 2n-1) represent the two ends of the n-th domino:
%e A383191 |
%e A383191 |    19==18  14==15  26==27
%e A383191 |
%e A383191 |    17   3===2   8===9
%e A383191 |    ||
%e A383191 |    16   4   0===1  12==13       The sequence is obtained by reading the numbers
%e A383191 |         ‖                       along the square spiral: starting at the origin
%e A383191 |    20   5   6  10==11           (0), go 1 right (1), 1 up (8), 2 left (2 and 3),
%e A383191 |    ||       ‖                   2 down (4 and 5), 3 right (6, 10, 11), 3 up
%e A383191 |    21  22   7  24  28==29       (12, 9, 26) 4 left (15, 14, 18, 19), etc.
%e A383191 |        ||      ||
%e A383191 |        23      25
%e A383191 |
%e A383191 We see that all dominoes in the upper right half plane are placed horizontally, and in the lower left half they are placed "vertically".
%o A383191 (Python)
%o A383191 class A383191(A383190): # use A383191(n) or a=A383191(); a(n); a[m:n]; print(a)
%o A383191     def __call__(self, n: int) -> int:
%o A383191         "Return A383191(n)."
%o A383191         if isinstance(n, int) and n >= 0:
%o A383191             while n not in self.terms: self.extend()
%o A383191             return self.terms.index(n) # this is the inverse permutation of 'terms'
%o A383191         if n is None: return self # because A383191() => A383190(n=None) => a(n)
%o A383191         raise ValueError(f"Expected non-negative index n, got {n = !r}.")
%o A383191 A383191()[:50]   # list [a(0) .. a(49)]
%o A383191 print(A383191()) # displays the grid filled so far (same as A383190)
%Y A383191 Cf. A383190 (inverse permutation), A316328 (knight tour with illustration of square spiral), A174344 (square spiral, but clockwise), A316667 (square spiral starting with 1).
%K A383191 nonn
%O A383191 0,3
%A A383191 _M. F. Hasler_, Apr 18 2025