login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A215471 Numbers n such that in a rotated-square spiral with positive integers (A215468) among n's eight nearest neighbors five or more are primes. 3
8, 30, 138, 658, 2620, 3010, 3168, 3372, 3462, 8628, 11940, 17682, 24918, 27918, 32560, 39228, 39790, 40128, 43608, 48532, 53268, 55372, 56040, 56712, 73362, 85200, 85888, 90646, 96052, 101748, 102652, 104382, 112068, 113932, 115330, 119298, 128518, 129288, 131500 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
LINKS
EXAMPLE
Spiral begins:
113
112 85 86
111 84 61 62 87
110 83 60 41 42 63 88
109 82 59 40 25 26 43 64 89
108 81 58 39 24 13 14 27 44 65 90
107 80 57 38 23 12 5 6 15 28 45 66 91
106 79 56 37 22 11 4 1 2 7 16 29 46 67 92
105 78 55 36 21 10 3 8 17 30 47 68 93
104 77 54 35 20 9 18 31 48 69 94
103 76 53 34 19 32 49 70 95
102 75 52 33 50 71 96
101 74 51 72 97
100 73 98
99
Among eight nearest neighbors of 30 five are primes: 7, 17, 31, 29, 47.
PROG
(Python)
SIZE = 3335 # must be odd
TOP = SIZE*SIZE
t = TOP//2
prime = [1]*t
prime[1]=0
for i in range(4, t, 2):
prime[i]=0
for i in range(3, t, 2):
if prime[i]==1:
for j in range(i*3, t, i*2):
prime[j]=0
grid = [0] * TOP
posX = posY = SIZE//2
saveX = [0]* (t+1)
saveY = [0]* (t+1)
grid[posY*SIZE+posX] = 1
saveX[1]=posX
saveY[1]=posY
posX += 1
grid[posY*SIZE+posX] = 2
saveX[2]=posX
saveY[2]=posY
n = 3
def walk(stepX, stepY, chkX, chkY):
global posX, posY, n
while 1:
posX+=stepX
posY+=stepY
grid[posY*SIZE+posX]=n
saveX[n]=posX
saveY[n]=posY
n+=1
if grid[(posY+chkY)*SIZE+posX+chkX]==0:
return
while posX!=SIZE-1:
walk(-1, 1, -1, -1) # down-left
walk(-1, -1, 1, -1) # up-left
walk( 1, -1, 1, 0) # up-right
walk( 1, 0, 1, 1) # right
walk( 1, 1, -1, 1) # down-right
for s in range(1, n):
posX = saveX[s]
posY = saveY[s]
a, b=(grid[(posY-1)*SIZE+posX-1]) , (grid[(posY-1)*SIZE+posX+1])
c, d=(grid[(posY+1)*SIZE+posX-1]) , (grid[(posY+1)*SIZE+posX+1])
e, f=(grid[(posY-1)*SIZE+posX ]) , (grid[(posY+1)*SIZE+posX ])
g, h=(grid[ posY *SIZE+posX-1]) , (grid[ posY *SIZE+posX+1])
if a*b==0 or c*d==0 or e*f==0 or g*h==0:
break
z = prime[a]+prime[b]+prime[c]+prime[d]
if z+prime[e]+prime[f]+prime[g]+prime[h] >= 5:
print s,
CROSSREFS
Cf. A039625.
Sequence in context: A293965 A161222 A229374 * A221145 A098741 A027146
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, Aug 11 2012
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 14:10 EDT 2024. Contains 371792 sequences. (Running on oeis4.)