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.

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