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 31-40 of 49 results. Next

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.

A079422 a(n) = number of 1's in the first n^2 Spiro-Fibonacci differences.

Original entry on oeis.org

0, 3, 7, 11, 15, 19, 24, 26, 32, 41, 49, 55, 61, 67, 75, 78, 83, 111, 119, 135, 139, 155, 160, 168, 182, 217, 229, 249, 259, 279, 293, 303, 312, 342, 399, 454, 493, 530, 566, 603, 642, 681, 722, 765, 817, 875, 909, 958, 992, 1044, 1107, 1160, 1215, 1267, 1315
Offset: 1

Views

Author

Neil Fernandez, Jan 07 2003

Keywords

Examples

			The Spiro-Fibonacci differences are 0,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,...(A079421). Terms are written in square boxes radiating spirally. a(n) = the sum of the first n^2 terms in A079421, i.e. the number of 1's in a spiral of height n and width n.
		

Crossrefs

Extensions

More terms from Sean A. Irvine, Aug 13 2025

A136627 For every number n in Ulam's spiral the sequence gives the number of primes around it (number n included).

Original entry on oeis.org

4, 3, 4, 3, 3, 3, 3, 3, 3, 2, 4, 5, 4, 2, 2, 2, 3, 3, 4, 3, 3, 2, 3, 2, 1, 0, 2, 3, 4, 3, 3, 3, 3, 1, 2, 2, 3, 3, 3, 2, 3, 3, 3, 1, 1, 2, 3, 2, 1, 1, 1, 1, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 3, 3, 1, 2, 3, 5, 4, 4, 3, 2, 0, 1, 2, 2, 1, 1, 1, 1, 1, 2, 2, 2, 1, 2, 2, 1, 0, 2, 2, 4, 3, 3, 1, 0, 1, 1, 2
Offset: 1

Views

Author

Keywords

Comments

In Ulam's lattice there are 8 numbers around any number. The sequence is similar to A136626 with an increment of 1 for any prime position.

Examples

			Numbers around 13 are 3, 12, 29, 30, 31, 32, 33, 14 -> 3, 29, 31 and 13 itself are primes, so a(13)=4.
		

Crossrefs

Extensions

Offset 1 per example and correction for a(32) by Kevin Ryde, Jul 04 2020

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

A344660 Lexicographically earliest sequence of distinct nonnegative terms on a square spiral such that each term, when written with one digit per square, forms no prime value in the eight sums when each digit is added to each of its eight nearest neighbors.

Original entry on oeis.org

0, 1, 8, 80, 4, 6, 88, 7, 77, 2, 24, 40, 44, 22, 26, 27, 3, 5, 9, 72, 28, 42, 46, 48, 62, 64, 66, 68, 87, 13, 31, 37, 78, 82, 84, 86, 60, 400, 422, 222, 63, 601, 73, 33, 15, 35, 17, 10, 18, 224, 226, 404, 406, 424, 227, 286, 36, 99, 39, 19, 53, 55, 57, 59, 90, 93, 772, 228, 240, 408, 440, 426
Offset: 1

Views

Author

Eric Angelini and Scott R. Shannon, May 26 2021

Keywords

Comments

Terms are broken into digits before entering the spiral.
The sequence is finite. After 181 terms (and 466 digits) the number 101 is entered. The next square is surrounded by digits 0,1,8 so the only available digit is 8. As 8 has already appeared in the sequence another digit must be added to form a new number, but the next square is now surrounded with digits 0,1,3,8, and it is not possible to find a digit such that its sum with each of those digits is not prime.
.
4---0---4---6---2---2---4---2---2---8---1
| |
4 4---0---6---6---8---4---8---2---8 0
| | | |
. 0 4---6---4---2---4---8---2 8 1
. | | | | |
. 0 8 0---4---4---2---2 2 7 7
. | | | | | | |
. 4 6 4 0---8---8 7 7 7 1
. | | | | | | | | |
. 2 2 4 4 0---1 7 9 3 5
. | | | | | | | |
. 2 6 2 6---8---8---7 5 1 3
. | | | | | |
. 2 4 2---2---6---2---7---3 3 5
. | | | |
. 2 6---6---6---8---8---7---1---3 1
. | |
. 2---6---3---6---0---1---7---3---3---3
.

Examples

			The eight digits that are in contact with the initial zero are 1, 8, 8, 0, 4, 6, 8, 8: none of them is prime [forcing the sum a(k) + 0 to be nonprime, with k<9]; more generally, no term of the square spiral added to any of its eight nearest neighbors sums to a prime.
		

Crossrefs

A345293 a(n) is the first number on the n-th layer in a layered square spiral of primes.

Original entry on oeis.org

2, 73, 149, 211, 307, 467, 659, 839, 1061, 1319, 1511, 1697, 1949, 2129, 2381, 2677, 2819, 3137, 3307, 3407, 3559, 3907, 4079, 4253, 4591, 4877, 5087, 5443, 5531, 5683, 5923, 6221, 6659, 6791, 6997, 7393, 7603, 8111, 8297, 8641, 8887, 9029, 9377, 9461, 9749
Offset: 1

Views

Author

Ya-Ping Lu, Jun 13 2021

Keywords

Comments

The first prime, 2, is placed at the origin with Cartesian coordinates of (0, 0, 0) and the second prime, 3, is placed at (1, 0, 0). The m-th prime (m >= 3) is placed by moving one unit forward in the direction from the (m-2)-th prime to the (m-1)-th prime, if the next prime is not a twin prime of the current one; otherwise, by turning 90 degrees counterclockwise and moving one unit forward. When it comes to a spot already occupied by another number, the prime is moved up one layer above the number.

Examples

			First layer starts from 2 and second layer from 73.
  59<--53<--47<--43<--41
   |                   |
  61   11<---7<---5   37     137<-131<-127<-113<-109<-107
   |    |         |    |      |                        |
  67   13    2--->3   31     139                      103
   |    |              |                               |
  71   17-->19-->23-->29      73-->79-->83-->89-->97->101
		

Crossrefs

Programs

  • Python
    from sympy import prime, nextprime
    print(2); d1 = 0; L = [0, 0, 0]; L1 = []
    for i in range(1, 1501):
        p = prime(i); np = nextprime(p); d = (d1 + 1)%4 if np - p == 2 else d1
        L[0] += 1 if d == 0 else -1 if d == 2 else 0
        L[1] += 1 if d == 1 else -1 if d == 3 else 0
        if L in L1: L[2] += 1; print(np)
        L1.append([L[0], L[1], L[2]]); d1 = d

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.
Previous Showing 31-40 of 49 results. Next