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-10 of 18 results. Next

A330782 The records for distance squared for step lengths between adjacent composite numbers in A332767, the visited composite numbers for a walk stepping to the closest unvisited composite number on the 2D square (Ulam) spiral.

Original entry on oeis.org

1, 2, 8, 32, 40, 68, 98, 148, 162, 356, 450
Offset: 1

Views

Author

Scott R. Shannon, Feb 23 2020

Keywords

Comments

The sequence A332767 gives the visited composite numbers for a walk on the 2D square (Ulam) spiral which starts at 1 and then steps to the square containing the closest unvisited composite number. This sequences lists the records for the square of the step distance between visited composite numbers for that walk. For a walk of 1 million steps the largest square distance is 450, approximately 21.1 units, which occurs between A332767(149464) = 64666, which has coordinates (-127,-22) relative to the starting 1-square, to A332767(149465) = 67774 with coordinates (-130,-43). See A332767 for an image of the walk. It is unknown if this is a finite or infinite sequence.

Examples

			The below table shows the details of the record step lengths of this sequence for the first 1 million steps. The coordinate is relative to the starting 1-square.
--------------------------------------------------------------------------------
    a(n)  | A332767 step # |   Start value & coord   |  End value & coord      |
--------------------------------------------------------------------------------
       1  |         1      |         1 (0,0)         |         4 (0,1)         |
       2  |         6      |        32 (2,3)         |        30 (3,2)         |
       8  |       154      |        74 (-3,-4)       |       158 (-5,-6)       |
      32  |      4501      |      5526 (-37,-12)     |      6782 (-41,-16)     |
      40  |     65877      |     48150 (110,79)      |     53558 (116,81)      |
      68  |     91787      |    126154 (178,-49)     |    137780 (186,-47)     |
      98  |    125472      |    145762 (-28,191)     |    156654 (-35,198)     |
     148  |    142733      |    105316 (-147,-162)   |    102746 (-135,-160)   |
     162  |    142741      |     92744 (-129,-152)   |     82106 (-120,-143)   |
     356  |    142869      |     67818 (-130,-87)    |     57792 (-120,-71)    |
     450  |    149464      |     64666 (-127,-22)    |     67774 (-130,-43)    |
		

Crossrefs

A335661 The squares visited on a square (Ulam) spiral, with a(1) = 1 and a(2) = 2, when stepping to the closest unvisited square containing a number that shares a common divisor > 1 with the number in the current square. If two or more such squares are the same distance from the current square then the one with the smallest number is chosen.

Original entry on oeis.org

1, 2, 4, 6, 8, 22, 20, 40, 18, 39, 69, 105, 150, 104, 66, 38, 36, 63, 98, 62, 34, 14, 12, 3, 15, 5, 35, 60, 33, 30, 55, 88, 54, 87, 129, 177, 234, 299, 455, 375, 456, 374, 300, 235, 130, 90, 57, 93, 135, 186, 134, 92, 58, 32, 56, 91, 133, 182, 132, 180, 237
Offset: 1

Views

Author

Scott R. Shannon, Jun 17 2020

Keywords

Comments

Any even number on the square spiral has 4 diagonally adjacent squares which contain an even number and thus, unless all four such squares have been previously visited, a step to one of those adjacent squares, the one containing the smallest number, will always be possible. Any visited square containing a prime number will need to step to, and be stepped to from, a square containing a multiple of that prime number.
In the first 10 million terms the longest required step is from a(97528) = 5981, a prime number which has coordinates (39,13) relative to the starting 1-square, to a(97529) = 167468 (27*5981), with coordinates (205,-18), a step of length sqrt(28517), approximately 168.9 units. This is an extremely large step length relative to the total number of steps taken up to that point - see the attached link image. It is not surpassed by any subsequent step up to 10 million steps. If the maximum step distance between adjacent terms has a finite value or is unbounded as n increases is unknown. The largest difference between terms is for a(9404208) = 8964653 to a(9404209) = 10485343, a difference of 1520690.
In the first 10 million terms the smallest unvisited square is 37, which has coordinates (-3,3) relative to the starting 1-square. It is unknown if this square, and similar unvisited squares near the origin, is eventually visited for very large values of n or is never visited. The longest run of diagonal steps in the same direction to adjacent smaller even numbers is 52, from a(3979714) = 5051162 to a(3979766) = 4594498.

Examples

			a(3) = 4 as a(2) = 2 is surrounded by eight adjacent squares with numbers 3,4,1,8,9,10,11,12. The unvisited squares 1 unit away, 3,9,11 have no common factor with 2. Of the other squares sqrt(2) units away, 4,8,10,12, all share the common factor 2 with a(2), and the smallest of those is 4.
a(10) = 39 as a(9) = 18 is surrounded by adjacent squares 5,6,19,40,39,38,17,16. The square containing 39 is 1 unit directly left of 18 and shares the common factor 3. The other squares one unit away, 5,17,19, have no common factor with 18.
		

Crossrefs

A344325 Squares visited on a spirally numbered board when stepping to the closest unvisited square which contains a number that shares no digit with the number of the current square. If two or more such squares are the same distance away the one with the smaller number is chosen.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 25, 48, 79, 80, 49, 26, 51, 84, 125, 83, 50, 81, 52, 86, 53, 28, 11, 27, 85, 126, 87, 54, 29, 30, 55, 88, 129, 56, 31, 58, 93, 57, 90, 131, 89, 130, 92, 135, 94, 137, 95, 60, 33, 14, 32, 59, 13, 62, 35, 16, 34, 15, 36, 17, 38, 67, 104, 66, 37, 64, 99, 100, 65, 102
Offset: 1

Views

Author

Scott R. Shannon and Eric Angelini, May 15 2021

Keywords

Comments

The sequence is infinite as a number containing all ten decimal digits can never be stepped to thus there will always be a square containing a number which has digits not in the number of the current square.
The pattern of visited squares forms nine closely spaced concentric square rings, while these groups of nine have a larger gap of unvisited squares between them. See the linked images.
In the first one million steps the largest single step distance is ~480 units, from a(572017) = 627194 to a(572018) = 3055000. This is a step that jumps between the inner to most outer group of nine concentric rings. The largest single step difference between numbers is from a(721912) = 6951823 to a(721913) = 4404077, a change of 2547746. The smallest unvisited number in the first one million steps is 12, although the image shows the path revisits squares close to the origin after a large number of steps, so it is possible this and other small numbers will eventually be visited.

Examples

			The board is numbered with the square spiral:
.
  17--16--15--14--13   .
   |               |   .
  18   5---4---3  12   29
   |   |       |   |   |
  19   6   1---2  11   28
   |   |           |   |
  20   7---8---9--10   27
   |                   |
  21--22--23--24--25--26
.
a(2) = 2 as from 1 there are four numbers one unit away, 2,4,6,8, none of which contain the digit 1, so of these the smallest is chosen, which is 2.
a(11) = 25 as from the square 10 the square with 25 is only one unit away and shares no digit with 10.
a(20) = 83 as the four squares one unit away from 125 have been visited or contain digits 1,2 or 5. The square with 83 is diagonally adjacent to 125 and is the first time a square more than one unit away is stepped to.
a(23) = 52, and is the first square stepped to that is not adjacent to the previous square, being three units away from 81. All closer squares have been either visited or contain a 1 or 8 in their number.
		

Crossrefs

A344367 Squares visited on a spirally numbered board when stepping to the closest unvisited square that contains a number that shares one or more digits with the number of the current square. If two or more such squares are the same distance away the one with the smaller number is chosen.

Original entry on oeis.org

1, 11, 10, 12, 13, 14, 15, 16, 17, 18, 19, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 3, 23, 22, 21, 20, 40, 41, 42, 43, 44, 45, 46, 47, 24, 25, 26, 27, 28, 29, 2, 52, 51, 50, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 59, 58, 57, 56, 55, 54, 53, 125, 124, 123, 122, 121, 120
Offset: 1

Views

Author

Scott R. Shannon and Eric Angelini, May 16 2021

Keywords

Examples

			The board is numbered with the square spiral:
.
  17--16--15--14--13   .
   |               |   .
  18   5---4---3  12  29
   |   |       |   |   |
  19   6   1---2  11  28
   |   |           |   |
  20   7---8---9--10  27
   |                   |
  21--22--23--24--25--26
.
a(2) = 11. There are three squares 2 units away from the starting square 1 that also contain the digit 1 - 11, 15, and 19. Of these 11 is the smallest so is the square stepped to.
a(3) = 10. Of the two adjacent squares to 11 that also contain the digit 1 the square 10 is the smallest.
a(4) = 12. This is the only unvisited square within 2 units of a(3) = 10 that also contains the digit 1.
a(12) = 39. This is the only unvisited square within sqrt(2) units of a(11) = 19 that contains either the digit 3 or 9. It is also the first square stepped to that does not share the digit 1 with the previous square.
		

Crossrefs

A347358 The prime numbers visited on a square spiral when starting at 1 and then stepping to the smallest unvisited prime number that is visible from the current number.

Original entry on oeis.org

1, 2, 3, 11, 5, 13, 29, 17, 7, 19, 31, 23, 37, 53, 41, 61, 43, 59, 47, 71, 83, 67, 89, 73, 101, 79, 107, 127, 97, 131, 103, 137, 109, 139, 113, 149, 173, 151, 179, 157, 181, 163, 191, 167, 193, 227, 197, 229, 293, 233, 211, 239, 199, 251, 223, 257, 307, 241, 311, 263, 313, 269, 317, 271, 331, 277
Offset: 1

Views

Author

Scott R. Shannon, Aug 28 2021

Keywords

Comments

A number is visible from the current number if, given it has coordinates (x,y) relative to the current number, the greatest common divisor of |x| and |y| is 1. See A331400 for the points visible from the starting 1 number.
The primes visited in the sequence appear to oscillate between two different regimes. In one the vast majority of the next smallest visible primes are on the corners of the neighboring inner or outer square ring of numbers, thus the steps are nearly vertical or horizontal relative to the current square. In the other the majority of next smallest visible primes are on square rings much closer or further away from the origin than the current ring, or entirely on the other side of the spiral relative to the starting number. In this regime the path makes very random steps in many different diagonal directions, covering the entire spiral. See the three linked images.

Examples

			The square spiral is numbered as follows:
.
  17--16--15--14--13   .
   |               |   .
  18   5---4---3  12   29
   |   |       |   |   |
  19   6   1---2  11   28
   |   |           |   |
  20   7---8---9--10   27
   |                   |
  21--22--23--24--25--26
.
a(1) = 1. The central starting number.
a(2) = 2, a(3) = 3 as 2 is the smallest visible unvisited prime from 1, and 3 is the smallest visible unvisited prime from 2.
a(4) = 11 as 11 is the smallest visible unvisited prime from 3. Note that from 3 the smaller unvisited primes 5 and 7 are hidden from 3 by the numbers 4 and 1.
a(7) = 29 as 29 is the smallest visible unvisited prime from 13. Note that from 13 the smaller unvisited primes 7, 17, 19, 23 are hidden from 13 by numbers 3, 14, 4, 2 respectively.
		

Crossrefs

Cf. A347522 (step to smallest hidden), A000040, A063826, A214664, A214665, A331400, A335364, A332767, A330979.

A341541 a(n) is the number of steps to reach square 1 for a walk starting from square n along the shortest path on the square spiral board without stepping on any prime number. a(n) = -1 if such a path does not exist.

Original entry on oeis.org

0, 1, 2, 1, 2, 1, 2, 1, 2, 3, 4, -1, 4, 3, 2, 3, 4, 19, 2, 17, 16, 15, 2, 3, 4, 5, 4, 5, 6, 11, 6, 5, 4, 3, 4, 5, 6, 19, 18, 19, 18, 17, 16, 15, 14, 13, 4, 5, 6, 7, 6, 5, 6, 9, 10, 11, 10, 9, 6, 5, 4, 5, 6, 7, 8, 9, 10, 17, 18, 19, 18, -1, 16, 15, 14, 13, 12
Offset: 1

Views

Author

Ya-Ping Lu, Feb 14 2021

Keywords

Comments

Conjecture: There is no "island of two or more nonprimes" enclosed by primes on the square spiral board. If the conjecture is true, then numbers n such that a(n) = -1 are the terms in A341542.

Examples

			The shortest paths for a(n) <= 20 are illustrated in the figure attached in Links section. If more than one path are available, the path through the smallest number is chosen as the shortest path.
		

Crossrefs

Programs

  • Python
    from sympy import prime, isprime
    from math import sqrt, ceil
    def neib(m):
        if m == 1: L = [4, 6, 8, 2]
        else:
            n = int(ceil((sqrt(m) + 1.0)/2.0))
            z1 = 4*n*n - 12*n + 10; z2 = 4*n*n - 10*n + 7; z3 = 4*n*n - 8*n + 5
            z4 = 4*n*n - 6*n + 3; z5 = 4*n*n - 4*n + 1
            if m == z1:             L = [m + 1, m - 1, m + 8*n - 9, m + 8*n - 7]
            elif m > z1 and m < z2: L = [m + 1, m - 8*n + 15, m - 1, m + 8*n - 7]
            elif m == z2:           L = [m + 8*n - 5, m + 1, m - 1, m + 8*n - 7]
            elif m > z2 and m < z3: L = [m + 8*n - 5, m + 1, m - 8*n + 13, m - 1]
            elif m == z3:           L = [m + 8*n - 5, m + 8*n - 3, m + 1, m - 1]
            elif m > z3 and m < z4: L = [m - 1, m + 8*n - 3, m + 1, m - 8*n + 11]
            elif m == z4:           L = [m - 1, m + 8*n - 3, m + 8*n - 1, m + 1]
            elif m > z4 and m < z5: L = [m - 8*n + 9, m - 1, m + 8*n - 1, m + 1]
            elif m == z5:           L = [m - 8*n + 9, m - 1, m + 8*n - 1, m + 1]
        return L
    step_max = 20; L_last = [1]; L2 = L_last; L3 = [[1]]
    for step in range(1, step_max + 1):
        L1 = []
        for j in range(0, len(L_last)):
            m = L_last[j]; k = 0
            while k <= 3 and isprime(m) == 0:
                m_k = neib(m)[k]
                if m_k not in L1 and m_k not in L2: L1.append(m_k)
                k += 1
        L2 += L1; L3.append(L1); L_last = L1
    i = 1
    while i:
        if isprime(neib(i)[0])*isprime(neib(i)[1])*isprime(neib(i)[2])*isprime(neib(i)[3]) == 1: print(-1)
        elif i not in L2: break
        for j in range(0, len(L3)):
            if i in L3[j]: print(j); break
        i += 1

A335710 The smallest number on a square (Ulam) spiral in a 2D grid such that n steps in one of the four axial directions leads to each visited number sharing a common factor greater than 1 with the previous visited number.

Original entry on oeis.org

1, 3, 30, 1235, 2439, 90000, 88805, 4330458, 4322139, 22001763, 21983004, 1868098088, 2436807593
Offset: 0

Views

Author

Scott R. Shannon, Jun 18 2020

Keywords

Comments

Start with any number on a square (Ulam) spiral in a 2D grid and then continue to step right to the next square as long as the number in that square shares a common factor > 1 with the number in the current square. Count the steps one can take. Repeat this process in each of the other three axial directions left, upward and downward, and then take the maximum step length of these four directions. The sequence a(n) gives the smallest number such that the maximum step length of these four directions is n.
If a(13) exists it is greater than 5*10^11.

Examples

			a(0) = 1 as 1 has no common factor > 1 with its neighboring four squares.
a(1) = 3 as stepping right one step from 3 leads to 12 which shares the common factor 3.
a(2) = 30 as stepping right two steps from 30 leads to 55 and 88 which share the common factors 5 and 11 respectively.
a(3) = 1235 as stepping right three steps from 1235 leads to 1380, 1533, 1694 which share the common factors 5, 3, 7 respectively.
a(4) = 2439 as stepping right four steps from 2439 leads to 2640, 2849, 3066, 3291 which share the common factors 3, 11, 7, 3 respectively.
a(5) = 90000 as stepping upward five steps from 90000 leads to 91203, 92414, 93633, 94860, 96095 which share common factors 3, 7, 23, 3, 5 respectively.
a(6) = 88805 as stepping upward one step from 88805 leads to 90000, which shares a common factor 5, and then continues upwards with the same five steps as a(5).
a(7) = 4330458 as stepping downward seven steps from 4330458 leads to 4338785, 4347120, 4355463, 4363814, 4372173, 4380540, 4388915 which share common factors 11, 5, 3, 7, 13, 3, 5 respectively.
a(8) = 4322139 as stepping downward one step from 4322139 leads to 4330458, which shares a common factor 3, and then continue downward with the same seven steps as a(7).
a(9) = 22001763 as stepping downward nine steps from 22001763 leads to 22020530, 22039305, 22058088, 22076879, 22095678, 22114485, 22133300, 22152123, 22170954 which share common factors 7, 5, 3, 19, 11, 3, 5, 7, 3 respectively.
a(10) = 21983004 as stepping downward one step from 21983004 leads to 22001763, which shares a common factor 3, and then continue downward with the same nine steps as a(9).
a(11) = 1868098088 as stepping upward eleven steps from 1868098088 leads to 1868270979, 1868443878, 1868616785, 1868789700, 1868962623, 1869135554, 1869308493, 1869481440, 1869654395, 1869827358, 1870000329 which share common factors 23, 3, 7, 5, 3, 11, 13, 3, 5, 7, 3 respectively.
a(12) = 2436807593 as stepping left twelve steps from 2436807593 leads to 2437005054, 2437202523, 2437400000, 2437597485, 2437794978, 2437992479, 2438189988, 2438387505, 2438585030, 2438782563, 2438980104, 2439177653 which share common factors 11, 3, 7, 5, 3, 23, 13, 3, 5, 7, 3, 11 respectively.
		

Crossrefs

A336494 The number of steps for a walk on a square spiral numbered board when starting on square 1 and stepping to an unvisited square containing the lowest prime number, where the square is within a block of size (2n+1) X (2n+1) centered on the current square. If no unvisited prime numbered squares exist within the block the walk ends.

Original entry on oeis.org

7, 37, 65, 308, 654, 7214, 21992, 49850, 222791, 1146922, 1912101, 6372680, 23077800
Offset: 1

Views

Author

Scott R. Shannon, Jul 23 2020

Keywords

Comments

For n = 1 this sequence is similar to A335856 except that only prime numbers can be stepped to; if no adjacent prime number exists then the walk ends. In general for a(n) the walk can step to any unvisited square containing the lowest prime number within a block of size (2n+1) X (2n+1) centered on the current square.
See A336576 for the final square number of the walks.

Examples

			The board is numbered with the square spiral:
.
  17--16--15--14--13   .
   |               |   .
  18   5---4---3  12   29
   |   |       |   |   |
  19   6   1---2  11   28
   |   |           |   |
  20   7---8---9--10   27
   |                   |
  21--22--23--24--25--26
.
a(1) = 7. Starting from the square 1 the sequence of adjacent unvisited lowest primes the walk can step to are 2,3,11,29,13,31,59. Once the square 59 is visited there are no other unvisited adjacent squares containing primes, so the walk terminates after 7 steps. See the first linked image.
a(2) = 38. This walk also starts by stepping to 2 and then 3. But the next lowest prime 5 is now two units away so is reachable and is thus the next stepped to square. Further steps are 7,19,17,37...,827,829,719,947. Once the square 947 is visited there are no other unvisited squares containing primes within the surrounding 5x5 block of squares, so the walk terminates after 38 steps. See the second linked image.
Also see the linked images for n=3,4,5,6.
		

Crossrefs

Cf. A336576 (final square number), A335856, A000040, A136626, A336092, A330979, A332767, A335661, A335364.

A347357 The numbers visited on a square spiral when starting at 1 and then stepping to the smallest unvisited number that is not visible from the current number.

Original entry on oeis.org

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

Views

Author

Scott R. Shannon, Aug 28 2021

Keywords

Comments

A number is not visible from the current number if, given it has coordinates (x,y) relative to the current number, the greatest common divisor of |x| and |y| is greater than 1.
See A331400 for the points visible from the starting 1 number.

Examples

			The square spiral is numbered as follows:
.
  17--16--15--14--13   .
   |               |   .
  18   5---4---3  12   29
   |   |       |   |   |
  19   6   1---2  11   28
   |   |           |   |
  20   7---8---9--10   27
   |                   |
  21--22--23--24--25--26
.
a(1) = 1. The central starting number.
a(2) = 11 as the numbers 2..10 are all visible from 1, while 11 is hidden by 2.
a(3) = 6 as the numbers 2..5 are all visible from 11, while 6 is hidden by 1 and 2.
a(4) = 2 as 2 is the smallest unvisited number and from 6 it is hidden by 1.
a(5) = 14 as the unvisited numbers 3..5,7..10,12,13 are all visible from 2, while 14 is hidden by 3.
a(11) = 4 as 4 is the smallest unvisited number and from 10 it is hidden by 2. This is the first time a diagonal step is taken.
a(25) = 24 as 24 is the smallest unvisited number and from 16 it is hidden by 1. This is the first step that is not vertical, horizontal or along a 45-degree diagonal.
		

Crossrefs

Cf. A347518 (remove number after step), A063826, A214664, A214665, A331400, A330979, A332767.

A348022 The numbers visited on a square spiral when stepping to the smallest unvisited number that is visible from and shares a divisor > 1 with the current number. Start with 1 and 2.

Original entry on oeis.org

1, 2, 4, 6, 3, 12, 9, 15, 5, 10, 14, 7, 21, 27, 18, 16, 8, 22, 11, 33, 30, 20, 24, 32, 26, 13, 39, 36, 28, 35, 25, 40, 44, 38, 19, 76, 34, 17, 68, 42, 45, 51, 48, 57, 66, 55, 60, 46, 23, 92, 58, 50, 62, 31, 155, 70, 49, 56, 63, 72, 64, 52, 65, 78, 54, 69, 84, 75, 85, 80, 94, 47, 188
Offset: 1

Views

Author

Scott R. Shannon, Sep 25 2021

Keywords

Comments

A number is visible from the current number if, given it has coordinates (x,y) relative to the current number, the greatest common divisor of |x| and |y| equals 1. See A331400 for the points visible from the starting 1 number.
In the first 10000 terms the longest single step is one at n = 9942 of length sqrt(22570) units between 31002 to 10258. The maximum difference between terms in the same range is from 5171 to 36197 at n = 9977.

Examples

			The square spiral is numbered as follows:
.
  17--16--15--14--13   .
   |               |   .
  18   5---4---3  12   29
   |   |       |   |   |
  19   6   1---2  11   28
   |   |           |   |
  20   7---8---9--10   27
   |                   |
  21--22--23--24--25--26
.
a(3) = 4 as gcd(4,2) = 2 and 4 is unvisited and visible from 2.
a(4) = 6 as gcd(4,6) = 2 and 6 is unvisited and visible from 4.
a(5) = 3 as gcd(3,6) = 3 and 3 is unvisited and visible from 6.
a(6) = 12 as gcd(12,3) = 3 and 12 is unvisited and visible from 3. Note although 9 is unvisited and gcd(9,3) = 3 it is not visible from 3 due to 2.
		

Crossrefs

Cf. A348025 (not visible), A331400, A335661, A063826, A332767, A347358.
Showing 1-10 of 18 results. Next