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.

Previous Showing 41-49 of 49 results.

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

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

A331377 The areas of the triangles formed by joining three consecutive primes as vertices on the Ulam spiral.

Original entry on oeis.org

1, 2, 3, 3, 4, 4, 2, 6, 3, 6, 12, 0, 4, 6, 9, 4, 2, 8, 0, 6, 3, 9, 18, 4, 4, 0, 0, 2, 14, 18, 8, 2, 4, 6, 0, 18, 0, 6, 9, 0, 8, 2, 0, 4, 0, 72, 6, 3, 0, 0, 0, 10, 0, 18, 0, 0, 4, 4, 0, 3, 49, 28, 0, 0, 12, 24, 12, 6, 0, 0, 15, 9, 0, 6, 6, 0, 0, 16, 0, 0, 10, 0, 0, 3, 9, 0, 0, 0, 4, 0, 12, 12, 0, 0, 4, 24, 0, 11, 21, 12
Offset: 1

Views

Author

Scott R. Shannon, Jan 14 2020

Keywords

Comments

The sequences lists the areas of the triangles formed by joining three consecutive primes, A000040(n), A000040(n+1), and A000040(n+2), as vertices on the Ulam spiral. As n increases the majority of terms are zero as most of the consecutive primes triples will fall on the same vertical or horizontal line forming the square spiral; only those primes near the corners of the spiral will form nonzero area triangles.
Assuming the truth of the Legendre conjecture one can show all areas will be integer values. Consider that the area, A, of a triangle is given by half the magnitude of the cross product of the vectors from the second prime of the triple to the first and third primes, i.e., A = |x_1*y_2 - y_1*x_2|/2. Any two primes on the same vertical or horizontal line of the spiral will always be a multiple of two units apart, so either x_1 = 2*k, y_1 = 0, or x_1 = 0, y_1 = 2*k where k is an integer with |k| >= 0. Assuming the third prime is not on the same line then A will be an even number divided by 2, which is always an integer. The only possibility for A being a non-integer is for all three primes to lie on three different vertical and/or horizontal spiral lines. Note that only the lower-right corner of the spiral has an even number. Therefore if we start on any right vertical line moving counterclockwise one complete revolution all primes will be an even number from the first three visited corners, so any vector connecting these primes will be of the form (2*j,2*k), implying once again the resulting triangle will have an integer value. So the remaining possibility is that the path between the three consecutive primes crosses the south-east corner at least once, for example the first prime is on the lower horizontal line and then the second is on the adjacent vertical right line. Such an example would be 23 to 29. But now, due to the above restriction that the next prime cannot be on the top, left, or bottom line if the proceeding prime is on the right vertical line, the third prime would need to form a path of one complete revolution and be on the next outer right vertical line. In the example case given this means it would have to be 51 or more. But in completing this revolution the path crosses both the top-left corner of the spiral, which is next to the numbers of the form (2*p)^2, and also the bottom right corner, which is next to numbers of the form (2*p+1)^2, and so it crosses consecutive squares without forming a prime. This violates the Legendre conjecture which, if true, therefore implies all triangles between three consecutive primes on the Ulam spiral will have an integer area.
For an Ulam spiral of size 20001 by 20001, with largest prime just over 400 million, the largest triangle area is 5160, between consecutive primes 364008101, 364008181 and 364008371. The first occurrence of three consecutive triangles with the same area, with area > 0, is for primes (2293,2297,2309), (2297,2309,2311), (2347,2351,2357), all of which form a triangle of area 8. Sixteen other runs with three consecutive triangles with the same area were also found, but no run of four triangles. The smallest triangle area which has not been formed is 79, although this minimum value slowly increases as the spiral gets larger, so it is likely, but unknown, that eventually triangles of all integer values are created.

Examples

			a(1) = 1 as the relative coordinates of the first three primes, 2,3,5, from the central 1 square are (1,0), (1,1), and (-1,1), which form a triangle with area |0*0 - -2*-1|/2 = 1.
a(3) = 3 as the relative coordinates of the third to fifth primes, 5,7,11, from the central 1 square are (-1,1), (-1,-1), and (2,0), which form a triangle with area |-3*-1 - -3*1|/2 = 3.
a(12) = 0 as the relative coordinates of the twelfth to fourteenth primes, 37,41,43, from the central 1 square are (-3,3), (-3,-1), and (-3,-3), all of which lie on the same vertical line so the triangle formed has zero area.
		

Crossrefs

A338644 Square spiral of smallest distinct positive integers starting at 1 such that the four sums of each term with its four nearest neighbors is a prime number.

Original entry on oeis.org

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

Views

Author

Scott R. Shannon and Eric Angelini, Apr 21 2021

Keywords

Examples

			The square spiral starts:
.
     29--42--37--52--31--28--33
      |                       |
     54  19--22--15--16--13  34
      |   |               |   |
     43  24   7---4---3  10  27
      |   |   |       |   |   |
     30  17   6   1---2   9  20
      |   |   |           |   |
     53  14   5--12--11---8  21
      |   |                   |
     44  23--18--25--36--35--26
      |
     39--50--89--48--61--66--41..
.
a(2) = 2 as a(1) + 2 = 1 + 2 = 3, the smallest possible prime number.
a(3) = 3 as a(2) + 3 = 2 + 3 = 5, the next smallest possible prime number.
a(5) = 7 as a(4) + 7 = 4 + 7 = 11. Note a(5) cannot be 5 or 6 as when these are added to 4 the result is a composite number.
a(9) = 11 as a(8) + 11 = 12 + 11 = 23, and a(2) + 11 = 2 + 11 = 13, both being prime.
		

Crossrefs

Cf. A338642 (sum to composites), A000040, A063826, A260643, A334742, A307834, A338221.

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

A383595 a(n) is the smallest prime k such that (prime(n), k, u, v) are the vertices of a square in Ulam's spiral, where k < u < v are all primes; or -1 if there is no such k.

Original entry on oeis.org

-1, -1, -1, 56527, 59, 67, 251, -1, -1, 2473, 3001, 43, 43, 41, 173, 1621, 61, 59, 13, 141937, 13, 13, 10459, 331, 33211, 643, 179, 41, 41, 1429, 11, 11, 59, 59, 13, 127, 163, 157, 169957, 47, 103, 56519, 683, 2843, 6841, 211, 199, 311, 59407, 439, 11, 137, 274831
Offset: 1

Views

Author

Gonzalo Martínez, May 01 2025

Keywords

Comments

For each prime number prime(n) in Ulam's spiral, we search for the least 3 primes k, u, v, with k < u < v, such that (prime(n), k, u, v) are the vertices of a square whose sides are parallel to the rows and columns of the spiral, where a(n) equals k.
Given a prime p, some vertices are close to p. For example, for prime 13, the vertices are (13, 67, 73, 79), while for others they are not, such as 7, where the least primes are (7, 56527, 58567, 58687). On the other hand, primes such as 2, 3, 5, 19 and 23 are not vertices of any square with prime vertices.
Conjecture: if a prime is vertex of a square of prime vertices, then it is vertex of infinitely many squares whose vertices are prime. For example, in the case of 11, some of them are: (11, 59, 127, 131), (11, 137, 233, 239), (11, 769, 977, 991).
Questions: Which prime numbers are not vertices of any square with prime vertices? What condition must they satisfy?
Are there infinite primes p and q which are vertices of two squares with prime vertices? For example, 47 and 353 are vertices of the squares (47, 353, 109, 347) and (47, 353, 173, 359).

Examples

			For A000040(5) = 11, it is observed that 11 together with 127, 131 and 59 are the vertices of a square whose center is 55. And this is the smallest square of prime vertices that has 11 as one of its vertices. Since 59 is the smallest number between 127, 131 and 59, then a(5) = 59.
    .  .  .  .  .
  —11-28-53-86-127—
  —12-29-54-87-128—
  —13-30-55-88-129—
  —32-31-56-89-130—
  —59-58-57-90-131—
    .  .  .  .  .
		

Crossrefs

A347337 The prime numbers ordered by their distance from the origin of a square spiral which starts at 1. If two or more primes have the same distance from the origin the smaller prime appears first.

Original entry on oeis.org

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

Views

Author

Scott R. Shannon, Aug 27 2021

Keywords

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) = 2 as this is the only prime a distance of 1 unit from the origin.
a(2) = 3, a(3) = 5, a(4) = 7. All of these primes are a distance of
sqrt(2) units from the origin, so they are listed with the smaller primes first.
a(6) = 19 as this is 2 units from the origin, the same as a(5) = 11. This is the first prime that appears out of natural order as both 13 and 17 are sqrt(8) units, which is greater than 2 units, from the origin.
		

Crossrefs

A367914 Movement sequence in the counter-clockwise undulating spiral, whereby 1, 2, 3, 4 represent moves to the right, down, left and up.

Original entry on oeis.org

1, 4, 3, 4, 3, 2, 3, 2, 1, 2, 1, 2, 1, 4, 1, 4, 1, 4, 3, 4, 3, 4, 3, 4, 3, 2, 3, 2, 3, 2, 3, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4
Offset: 1

Views

Author

Hans G. Oberlack, Dec 04 2023

Keywords

Comments

y ^
|
4 | 2---3
| | |
3 | 2---3 4---3
| | |
2 | 2---3 2---3 4---3
| | | | |
1 | 2---3 2---3 4---3 4---3
| | | | |
0 | 1---2 1---2 1---4 1---4
| | | | |
-1 | 1---2 1-- 2 1---4 1---4
| | | | |
-2 | 1---2 1---4 1---4
| | |
-3 | 1---2 1---4
| | |
-4 | 1---4
+------------------------------------>
-4 -3 -2 -1 0 1 2 3 4 x

Crossrefs

Formula

a(k1)=1 with k1=i^2*8+i*0+2*j+1 with i,j >= 0 and j<=4i.
a(k2)=2 with k2=i^2*8+i*12+2*j+6 with i,j >= 0 and j<=4*i+3.
a(k3)=3 with k3=i^2*8+i*8+2*j+3 with i,j >= 0 and j<=4*i+2.
a(k4)=4 with k4=i^2*8+i*4+2*j+2 with i,j >= 0 and j<=4*i+1.

A383596 Integers in Ulam's spiral for which the numbers around them form a square whose four corners are all prime numbers.

Original entry on oeis.org

71, 95, 353, 701, 767, 1151, 1451, 1961, 2507, 3347, 4691, 5957, 7205, 9671, 13463, 15635, 21017, 26051, 27947, 28985, 34337, 42017, 49565, 50921, 52253, 52349, 55859, 57191, 63143, 75857, 79907, 80831, 81611, 92339, 101633, 102557, 106529, 110495, 114521, 116513, 121469, 131075, 136757, 137879, 144497
Offset: 1

Views

Author

Gonzalo Martínez, May 01 2025

Keywords

Comments

With the exception of the number 12, all numbers in Ulam's spiral are surrounded by at most 4 prime numbers. This sequence contains those k such that k together with the 8 surrounding numbers form a square whose 4 corners are prime numbers. That is, this sequence is formed by odd numbers k>1 such that A136626(k) = 4.

Examples

			71 is in this sequence, since the numbers around 71 in Ulam's spiral are 41, 42, 43, 70, 72, 107, 108 and 109, where the prime numbers 107, 109, 43 and 41 are the vertices of a square whose center is 71.
     .     .    .
  - 109 - 72 - 43 -
  - 108 - 71 - 42 -
  - 107 - 70 - 41 -
     .     .    .
		

Crossrefs

Programs

  • Python
    from sympy import isprime
    def ulam(x, y):
        k = max(abs(x), abs(y))
        return (2*k) ** 2 + 1 + (-1 if x > -y else 1) * (2*k + x - y)
    def is_A383596(n):
        x = A174344(n)
        y = A274923(n)
        return all(isprime(ulam(x + i, y + j)) for i in (-1, 1) for j in (-1, 1)) # David Radcliffe, Aug 04 2025

Extensions

a(45) corrected by David Radcliffe, Aug 04 2025
Previous Showing 41-49 of 49 results.