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

A355270 Lexicographically earliest sequence of positive integers on a square spiral such that the sum of adjacent pairs of numbers within each row, column and diagonal is distinct in that row, column and diagonal.

Original entry on oeis.org

1, 1, 1, 1, 2, 2, 3, 2, 4, 3, 3, 4, 4, 3, 5, 4, 2, 4, 3, 5, 4, 4, 2, 3, 6, 4, 6, 5, 7, 6, 2, 6, 3, 2, 5, 8, 4, 3, 6, 6, 7, 3, 5, 7, 6, 8, 8, 7, 1, 2, 7, 5, 1, 2, 5, 8, 6, 4, 8, 5, 6, 9, 7, 1, 4, 10, 1, 1, 6, 3, 9, 12, 5, 1, 7, 2, 1, 6, 4, 1, 13, 6, 4, 7, 9, 12, 10, 7, 11, 1, 5, 2, 10, 7, 4, 5, 8
Offset: 1

Views

Author

Scott R. Shannon, Jun 26 2022

Keywords

Comments

In the first 2 million terms the largest number is 1959, while the number 1, the most commonly occurring number, appears 10893 times. See the linked images.

Examples

			The spiral begins:
.
                                .
    4---8---5---2---3---6---2   :
    |                       |   :
    3   2---4---5---3---4   6   5
    |   |               |   |   |
    6   4   2---1---1   4   7   2
    |   |   |       |   |   |   |
    6   3   2   1---1   3   5   1
    |   |   |           |   |   |
    7   5   3---2---4---3   6   5
    |   |                   |   |
    3   4---4---2---3---6---4   7
    |                           |
    5---7---6---8---8---7---1---2
.
a(25) = 6 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) = 3. The sums of adjacent pairs of numbers in a(25)'s column are 3 + 3 = 6, 3 + 4 = 7, 4 + 4 = 8, in its northwest diagonal are 4 + 1 = 5, 1 + 2 = 3, 2 + 2 = 4, and in its row are 3 + 2 = 5, 2 + 4 = 6, 4 + 4 = 8. Setting a(25) to 1 would create a sum of 5 with its diagonal neighbor 4, but 5 has already occurred as a sum on this diagonal. Similarly numbers 2, 3, 4 and 5 can be eliminated as they create sums with the three adjacent numbers, 3, 4, and 3, which have already occurred along the corresponding column, diagonal or row. This leaves 6 as the smallest number which creates new sums, namely 9, 10 and 9, with its three neighbors that have not already occurred along the corresponding column, diagonal and row.
		

Crossrefs

A362746 a(1)=a(2)=1; a(n)=The count of all occurrences in the list so far where integer a(n-1) appears adjacent to integer a(n-2).

Original entry on oeis.org

1, 1, 2, 1, 2, 2, 2, 3, 1, 1, 4, 1, 2, 3, 2, 3, 3, 2, 4, 1, 3, 2, 5, 1, 1, 6, 1, 2, 4, 2, 3, 6, 1, 3, 3, 4, 1, 4, 4, 2, 4, 4, 4, 5, 1, 2, 5, 2, 3, 7, 1, 1, 8, 1, 2, 6, 1, 4, 5, 2, 4, 5, 3, 1, 4, 6, 1, 5, 3, 2, 8, 1, 3, 5, 3, 4, 2, 6, 2, 3, 9, 1, 1, 10, 1, 2, 7
Offset: 1

Views

Author

Gavin Lupo, May 01 2023

Keywords

Examples

			a(1) = 1.
a(2) = 1.
a(3) = 2. How many 1's so far are adjacent to a 1? = 2.
a(4) = 1. How many 2's so far are adjacent to a 1? = 1.
a(5) = 2. How many 1's so far are adjacent to a 2? = 2.
a(6) = 2. How many 2's so far are adjacent to a 1? = 2.
		

Crossrefs

Programs

  • Mathematica
    K = {1, 1}; While[Length@K < 87, A = Position[K, Last@K]; c = 0; For[a = 1, a <= Length@A, a++, If[K[[A[[a]] - 1]] == {K[[Length@K - 1]]} || K[[A[[a]] + 1]] == {K[[Length@K - 1]]}, c++]]; AppendTo[K, c]]; Print[K] (* Samuel Harkness, May 08 2023 *)
  • Python
    from itertools import islice
    from collections import Counter
    def agen(): # generator of terms
        aprev, an, anext, c = 0, 1, 1, Counter({(1, 1)})
        while True:
            aprev, an, anext = an, anext, c[an, anext]
            c[an, anext] += 1
            if aprev != anext: c[anext, an] +=  1
            yield an
    print(list(islice(agen(), 100))) # Michael S. Branicky, May 02 2023

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.

Original entry on oeis.org

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, 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, 1, 2, 4, 3, 1, 2, 3, 5, 1, 1, 3, 3, 4, 1, 3, 6, 4, 1, 1
Offset: 1

Views

Author

Samuel Harkness, Oct 06 2023

Keywords

Comments

The maximum value the sequence can reach is 9 (and which occurs first at n = A366312(9)).
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.

Examples

			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.
.
   4    2    3    5    4    2    2
   1    2    4    4    3    2    2
   1    3    2    1    1    4    3
   5    3    2    1    1    3    5
   4    4    3    2    4    3    2
   1    2    3    4    4    2    2
   1    1  a(45)
.
The first 144 terms:
  4---2---1---4---6---2---4---1---3---2---2---1
                                              |
  2---4---1---3---2---4---1---1---3---4---1   1
  |                                       |   |
  2   3---3---1---2---3---5---5---1---3   4   4
  |   |                               |   |   |
  3   1   4---2---3---5---4---2---2   3   4   5
  |   |   |                       |   |   |   |
  6   4   1   2---4---4---3---2   2   1   3   2
  |   |   |   |               |   |   |   |   |
  2   5   1   3   2---1---1   4   3   1   1   2
  |   |   |   |   |       |   |   |   |   |   |
  2   1   5   3   2   1---1   3   5   4   1   3
  |   |   |   |   |           |   |   |   |   |
  3   2   4   4   3---2---4---3   2   5   4   3
  |   |   |   |                   |   |   |   |
  3   4   1   2---3---4---4---2---2   1   6   5
  |   |   |                           |   |   |
  5   3   1---1---5---5---6---1---1---2   3   4
  |   |                                   |   |
  4   1---2---3---5---1---1---3---3---4---1   2
  |                                           |
  3---2---2---6---4---3---2---4---4---3---2---1
.
		

Crossrefs

Cf. A355271, A366312 (indices of first occurrence of n).
Cf. A174344, A274923 (spiral coordinates).

Programs

  • MATLAB
    % See Harkness link.

A366312 Index of first occurrence of n in A366311.

Original entry on oeis.org

1, 5, 7, 9, 28, 47, 1031, 745771, 115318369671
Offset: 1

Views

Author

Samuel Harkness, Oct 06 2023

Keywords

Crossrefs

Programs

  • C
    /* See Ryde link. */
  • MATLAB
    % See Harkness link.
    

Extensions

a(9) from Kevin Ryde, Oct 12 2023
Showing 1-4 of 4 results.