OFFSET
1,1
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.
EXAMPLE
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 -
. . .
PROG
(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
CROSSREFS
KEYWORD
nonn
AUTHOR
Gonzalo MartÃnez, May 01 2025
EXTENSIONS
a(45) corrected by David Radcliffe, Aug 04 2025
STATUS
approved
