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 11-17 of 17 results.

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

A336576 The final square number 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

59, 947, 313, 3331, 5659, 67547, 253801, 676259, 3162413, 16604417, 29135971, 108235159, 437456497
Offset: 1

Views

Author

Scott R. Shannon, Jul 26 2020

Keywords

Comments

See A336494 for an explanation of the sequence and images of the walks.

Examples

			a(1) = 59. 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.
		

Crossrefs

Cf. A336494 (total number of steps), A335856, A000040, A136626, A336092, A330979, A332767, A335661, A335364.

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

A357376 The lowest number on Ulam Spiral for which all numbers in the square which is centered at a(n) and spans n-1 spaces in each cardinal direction are nonprime.

Original entry on oeis.org

1, 26, 1016, 5136, 39639, 203100, 2729736, 32264250, 42119062, 1065799391, 12444190246
Offset: 1

Views

Author

Samuel Harkness, Sep 26 2022

Keywords

Comments

The n-th term creates a (2*n-1) X (2*n-1) square centered at a(n).

Examples

			For n=2, test squares with 1 layer of numbers around the center number until a square is enclosed with only nonprimes.
.
   65   64   63   62   61   60   59   58   57
.
   66   37   36   35   34   33   32   31   56
.
   67   38   17   16   15   14   13   30   55
.
   68   39   18    5    4    3   12   29   54
.
   69   40   19    6    1    2   11   28   53
.                              +--------------+
   70   41   20    7    8    9 | 10   27   52 |
.                              |              |
   71   42   21   22   23   24 | 25   26   51 |
.                              |              |
   72   43   44   45   46   47 | 48   49   50 |
.                              +--------------+
   73   74   75   76   77   78   79   80   81
.
The first number tested, 1, does not work because 2, 3, 5 and 7 are in the 1-layered square and are prime. The first square that works is 26 because 10, 27, 52, 25, 26, 51, 48, 49, and 50 are all nonprime.
		

Crossrefs

Extensions

a(8)-a(11) from Rémy Sigrist, Sep 27 2022

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

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

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 11-17 of 17 results.