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 11 results. Next

A335364 The squares visited on the Ulam spiral when starting at square 1 and then stepping to the closest visible unvisited square which contains a prime number. If two or more visible squares are the same distance from the current square then the one with the smallest prime number is chosen.

Original entry on oeis.org

1, 2, 3, 11, 29, 13, 31, 59, 89, 131, 179, 127, 83, 53, 5, 17, 37, 67, 103, 149, 101, 61, 97, 139, 191, 251, 193, 137, 313, 389, 311, 241, 307, 379, 461, 383, 467, 557, 463, 761, 653, 757, 647, 751, 863, 983, 643, 547, 457, 239, 181, 233, 173, 229, 293, 227, 223, 167, 521, 433, 353, 281
Offset: 1

Views

Author

Scott R. Shannon, Jun 10 2020

Keywords

Comments

This sequence uses the same rules as A330979 except that, instead of stepping to the closest prime, the path steps to the closest visible square containing a prime i.e., squares containing a prime which have no other square on a line directly between the current position and the square. See A331400 for further details of the visibility of a square on the Ulam spiral.
The restriction of only visiting visible squares containing a prime substantially reduces the possible squares that the walk can step to. Consider the concentric square rings of squares surrounding any square in the Ulam spiral that contains an odd number, as all primes, other than, 2 will be. There are four squares on the adjacent ring of eight squares that are candidates for a visible prime. However on the second square ring of sixteen squares none are candidates as the only visible squares contain even numbers. This should be compared to A330979 where eight of these squares are candidates for the next step. On the third square ring of twenty-four squares only eight squares are candidates, while on the fourth square ring once again there are no candidates as only even numbers are visible. This reduction in nearby candidate squares is reflected by the average step distance for a walk of 10000 steps; in this sequence the average distance is 4.60 units while in A330979 it is 2.98 units.
The first time this sequence differs from A330979 is on the ninth step. A330979(9) = 61 while a(9) = 89. The square with prime 61 is two squares directly to left left of the square a(8) = 59 and is thus blocked from view by the square containing 60, which is one square to the left. The square with prime 89 is at relative coordinates (3,-1) to 59, being the closest visible unvisited prime, and is on the third square ring around 59.
In the first 10 million terms the longest required step is from a(4515899) = 29616101, which has coordinates (-2721,1985) relative to the starting 1-square, to a(4515900) = 28005727 with coordinates (-2646,2184), a step of length sqrt(45226), approximately 212.7 units. If the maximum step distance between adjacent prime terms has a finite value or is unbounded as n increases is unknown. The largest difference between adjacent prime terms is for a(9477992) = 132533039 to a(9477993) = 125850199, a difference of 6682840.
In the first 10 million terms the smallest unvisited prime is 571, which has coordinates (-6,12) relative to the starting 1-square. It is unknown if this and similar unvisited prime squares near the origin are eventually visited for very large values of n or are never visited.
The keyword "look" refers to the images in the links. - N. J. A. Sloane, Jun 14 2020

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.

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.

A332582 Label the cells of the infinite 2D square lattice with the square spiral (or Ulam spiral), starting with 1 at the center; sequence lists primes that are visible from square 1.

Original entry on oeis.org

2, 3, 5, 7, 29, 41, 47, 83, 89, 97, 103, 107, 109, 113, 173, 179, 181, 191, 193, 199, 223, 293, 311, 317, 347, 353, 359, 443, 449, 457, 461, 467, 479, 487, 491, 499, 503, 509, 521, 523, 631, 641, 643, 647, 653, 659, 661, 673, 683, 691, 701, 709, 719, 727, 857, 863, 887, 929, 947, 953, 1091
Offset: 1

Views

Author

Scott R. Shannon, Feb 17 2020

Keywords

Comments

Any grid point with relative coordinates (x,y) from the central grid point, which is numbered 1, and where the greatest common divisor (gcd) of |x| and |y| equals 1 will be visible from the central point. Grid points where gcd(|x|,|y|) > 1 will have another point directly between it and the central point and will thus not be visible. In an infinite 2D square lattice the ratio of visible grid points to all points is 6/Pi^2, approximately 0.608, the same as the probability of two random numbers being relative prime.
For a square spiral of size 10001 X 10001, slightly over 100 million numbers, a total of 60803664 numbers are visible, of which 2155170 are prime. The total number of primes in the same range is 5762536, giving a ratio of visible primes to all primes of about 0.374. This is significantly lower than the ratio for all numbers of 0.608, indicating a prime is more likely to be hidden from the origin than a random number.
Primes p such that A174344(p) and A268038(p) are coprime. - Robert Israel, Feb 16 2024

Examples

			The 2D grid is shown below. Composite numbers are shown as a '*'. The primes that are blocked from the central 1 square are in parentheses; these all have another composite or prime number directly between their position and the central square.
.
.
    *----*----*--(61)---*--(59)---*----*
                                       |
  (37)---*----*----*----*----*--(31)   *
    |                             |    |
    *  (17)---*----*----*--(13)   *    *
    |    |                   |    |    |
    *    *    5----*----3    *   29    *
    |    |    |         |    |    |    |
    *  (19)   *    1----2  (11)   *  (53)
    |    |    |              |    |    |
   41    *    7----*----*----*    *    *
    |    |                        |    |
    *    *----*--(23)---*----*----*    *
    |                                  |
  (43)---*----*----*---47----*----*----*
.
.
a(1) = 2 to a(4) = 7 are all primes adjacent to the central 1 point, thus all are visible from that square.
a(5) = 29 as primes 11, 13, 17, 19, 23 are blocked from the central 1 point by points numbered 2, 3, 5, 6, 8 respectively.
		

Crossrefs

Programs

  • Maple
    x:= 0: y:= 0: R:= NULL: count:= 0:
    for i from 2 while count < 100 do
      if x >= y then
        if x < -y + 1 then x:= x+1
        elif x > y then y:= y+1
        else x:= x-1
        fi
      elif x <= -y then y:= y-1
        else x:= x-1
      fi;
      if isprime(i) and igcd(abs(x),abs(y))=1 then R:= R,i; count:= count+1 fi
    od:
    R; # Robert Israel, Feb 16 2024

A332583 Label only the prime-numbered position cells of the infinite 2D square lattice with the square spiral (or Ulam spiral), starting with 1 at the center; sequence lists primes that are visible from square 1.

Original entry on oeis.org

2, 3, 5, 7, 19, 23, 29, 41, 47, 59, 61, 67, 71, 79, 83, 89, 97, 103, 107, 109, 113, 131, 137, 149, 167, 173, 179, 181, 191, 193, 199, 223, 227, 229, 239, 251, 263, 271, 277, 283, 293, 311, 317, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 409, 419, 433, 439, 443, 449, 457, 461, 467, 479, 487, 491, 499, 503
Offset: 1

Views

Author

Scott R. Shannon, Feb 17 2020

Keywords

Comments

Any grid point labeled with a prime number and with coordinates (x,y) relative to the central grid point, which is numbered 1, and where the greatest common divisor (gcd) of |x| and |y| equals 1 will be visible from the central point. Grid points where gcd(|x|,|y|) > 1 may have another prime grid point directly between it and the central point and will thus not be visible.
For a square spiral of size 10001 by 10001, slightly over 100 million numbers, a total of 5762536 primes are present, of which 4811013 are visible. This gives a ratio of visible primes to all primes of about 0.835.

Examples

			The 2D grid is shown below. The primes that are blocked from the central 1 square are in parentheses; these all have another prime number directly between their position and the central square.
.
.
-------------61-------59------+
                              |
(37)---------------------(31) |
|                         |   |
|  (17)--------------(13) |   |
|    |                |   |   |
|    |   5--------3   |   29  |
|    |   |        |   |   |   |
|   19   |   1----2  (11) | (53)
|    |   |            |   |   |
41   |   7------------+   |   |
|    |                    |   |
|    +-------23-----------+   |
|                             |
(43)-------------47-----------+
.
.
a(1) = 2 to a(4) = 7 are all primes adjacent to the central 1 point, thus all are visible from that square.
a(5) = 19 as primes 11,13,17 are blocked from the central 1 point by points with prime numbers 2,3,5 respectively.
a(14) = 79 as although the point 79 has relative coordinates of (2,-4) from the central square, gcd(|2|,|-4|) = 2, there is no other prime at coordinate (1,-2), thus it is visible. This square is not visible from the central square when nonprime points are also considered in the spiral.
		

Crossrefs

Extensions

Edited by N. J. A. Sloane, Feb 17 2020

A347518 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 and where the number is removed from the spiral once visited.

Original entry on oeis.org

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

Views

Author

Scott R. Shannon, Sep 04 2021

Keywords

Comments

On the standard square spiral 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. For this sequence at least one other number must also exist on the line connecting these two numbers for them to be hidden from each other. Most visited primes are stepped over by subsequent terms. See the first linked image.
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 is the central starting number.
a(2) = 11 as the numbers 2..10 are all visible from 1, while 11 is hidden by 2. After stepping to 11 the number 1 is removed.
a(3) = 6 as the numbers 2..5 are all visible from 11, while 6 is hidden by 2. After stepping to 6 the number 11 is removed.
a(4) = 14 as the numbers 2..5,7..10,12,13 are all visible from 6, while 14 is hidden by 4. After stepping to 14 the number 6 is removed. This is the first term that differs from A347357 as here the number 1 has been removed thus 2 is visible from 6.
		

Crossrefs

Cf. A347357 (do not remove number after step), A063826, A214664, A214665, A331400, A330979, A332767.

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

Original entry on oeis.org

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

Views

Author

Scott R. Shannon, Sep 05 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.
As n increases the vast majority of primes are on the same square ring of numbers as the current prime. However occasionally, especially for primes inside the right side quadrant, the next prime is on an outer or inner ring which causes the step to make a diagonal line. See the linked images. The largest diagonal step after 50000 terms is one at step 43936 between primes 532981 and 531457 which is seen as the long violet diagonal line from the top-left to the bottom-right in the image for these terms. No other such diagonal line is seen up to 10^6 terms.

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 smaller prime numbers 2,3,5,7 are all visible from 1, while 11 is hidden by 2.
a(3) = 13 as the smaller prime numbers 2,3,5,7 are all visible from 11, while 13 is hidden by 12.
a(4) = 7 as the smaller prime numbers 2,3,5 are visible from 13, while 7 is hidden by 1 and 3.
a(7) = 29 as the smaller prime numbers 2,17,19,23 are visible from 5, while 29 is hidden by 3,4 and 12.
		

Crossrefs

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

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

Original entry on oeis.org

1, 11, 55, 15, 21, 3, 9, 27, 30, 2, 6, 14, 16, 10, 4, 8, 12, 18, 20, 32, 34, 28, 22, 24, 26, 36, 33, 39, 42, 38, 40, 46, 44, 48, 45, 5, 25, 65, 13, 91, 7, 35, 49, 105, 51, 17, 153, 57, 19, 114, 50, 52, 54, 56, 66, 68, 62, 58, 29, 87, 84, 60, 63, 69, 23, 161, 77, 99, 93, 31, 124, 70, 72
Offset: 1

Views

Author

Scott R. Shannon, Sep 25 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. The sequence has a(2) = 11 as that is the smallest number not visible from a(1) = 1.
In the first 10000 terms the longest single step is one at n = 6888 of length sqrt(22556) units between 22203 to 7389. The maximum difference between terms in the same range is from 3469 to 58973 at n = 9709.

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) = 55 as gcd(55,11) = 11 and 55 is unvisited and not visible from 11, being blocked by 29.
a(4) = 15 as gcd(15,55) = 5 and 15 is unvisited and not visible from 55, being blocked by 13, 14 and 30.
a(5) = 21 as gcd(21,15) = 3 and 21 is unvisited and not visible from 15, being blocked by 6.
		

Crossrefs

A348026 The numbers visited on a square spiral when stepping to the smallest unvisited number that does not differ by 1 from the current number, is visible from the current number, and does not share a divisor > 1 with the current number.

Original entry on oeis.org

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

Views

Author

Scott R. Shannon, Sep 25 2021

Keywords

Comments

A number is visible from the current number if, given that it has coordinates (x,y) relative to the current number, the greatest common divisor of |x| and |y| is 1. The sequence has a(2) = 3 as that is the smallest number visible from a(1) = 1 that does not differ by 1 from a(1).
The majority of steps between terms are diagonals across the current number's nearest corner of the square spiral and thus do not approach the center of the spiral. Occasionally, however, a long diagonal step directly across the center of the spiral is taken. See the linked image.
In the first 20000 terms the longest single step is the one at n = 19534 of length sqrt(38365) units between 19743 at coordinates (-68,-70), to 19460 at coordinates (70,69). This step also yields the maximum difference between terms in the same range.

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) = 8 as gcd(8,3) = 1 and 8 is unvisited, visible from 3, and does not equal 2 or 4.
a(4) = 5 as gcd(5,8) = 1 and 5 is unvisited, visible from 8, and does not equal 7 or 9.
a(5) = 2 as gcd(2,5) = 1 and 2 is unvisited, visible from 5, and does not equal 4 or 6.
		

Crossrefs

Showing 1-10 of 11 results. Next