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!)
A215470 Prime intersections in a square spiral with positive integers: primes p such that there are four primes among eight nearest neighbors of p. 1

%I #15 Aug 13 2018 09:11:58

%S 71,353,701,1151,1451,3347,4691,13463,21017,27947,34337,42017,52253,

%T 57191,79907,80831,81611,121469,144497,159737,161141,256301,265547,

%U 284231,285707,312161,334511,346559,348617,382601,392069,422867,440303,502013,541061,545873,593207

%N Prime intersections in a square spiral with positive integers: primes p such that there are four primes among eight nearest neighbors of p.

%C Conjecture: the sequence is infinite. - _Alex Ratushnyak_, Sep 19 2012

%e The spiral begins:

%e .

%e 121 82--83--84--85--86--87--88--89--90--91

%e | | |

%e 120 81 50--51--52--53--54--55--56--57 92

%e | | | | |

%e 119 80 49 26--27--28--29--30--31 58 93

%e | | | | | | |

%e 118 79 48 25 10--11--12--13 32 59 94

%e | | | | | | | | |

%e 117 78 47 24 9 2---3 14 33 60 95

%e | | | | | | | | | | |

%e 116 77 46 23 8 1 4 15 34 61 96

%e | | | | | | | | | |

%e 115 76 45 22 7---6---5 16 35 62 97

%e | | | | | | | |

%e 114 75 44 21--20--19--18--17 36 63 98

%e | | | | | |

%e 113 74 43--42--41--40--39--38--37 64 99

%e | | | |

%e 112 73--72--71--70--69--68--67--66--65 100

%e | |

%e 111-110-109-108-107-106-105-104-103-102-101

%e .

%e Among eight nearest neighbors of 71 four are primes: 41, 43, 107, 109.

%o (Python)

%o SIZE = 3335 # must be odd

%o TOP = SIZE*SIZE

%o prime = [1]*TOP

%o prime[1]=0

%o for i in range(4,TOP,2):

%o prime[i]=0

%o for i in range(3,TOP,2):

%o if prime[i]==1:

%o for j in range(i*3,TOP,i*2):

%o prime[j]=0

%o grid = [0] * TOP

%o posX = posY = SIZE//2

%o grid[posY*SIZE+posX] = 1

%o n = 2

%o saveX = [0]* (TOP+1)

%o saveY = [0]* (TOP+1)

%o saveX[1]=posX

%o saveY[1]=posY

%o def walk(stepX, stepY, chkX, chkY):

%o global posX, posY, n

%o while 1:

%o posX+=stepX

%o posY+=stepY

%o grid[posY*SIZE+posX]=n

%o saveX[n]=posX

%o saveY[n]=posY

%o n+=1

%o if posX*posY==0 or grid[(posY+chkY)*SIZE+posX+chkX]==0:

%o return

%o while 1:

%o walk(0, -1, 1, 0) # up

%o if posX*posY==0:

%o break

%o walk(1, 0, 0, 1) # right

%o walk(0, 1, -1, 0) # down

%o walk(-1, 0, 0, -1) # left

%o for s in range(1, n):

%o if prime[s]:

%o posX = saveX[s]

%o posY = saveY[s]

%o a,b=(grid[(posY-1)*SIZE+posX-1]) , (grid[(posY-1)*SIZE+posX+1])

%o c,d=(grid[(posY+1)*SIZE+posX-1]) , (grid[(posY+1)*SIZE+posX+1])

%o if a*b==0 or c*d==0:

%o break

%o if prime[a]+prime[b]+prime[c]+prime[d]==4:

%o print s,

%Y Cf. A137928, A137930, A137931, A114254, A214176, A214177, A215471.

%K nonn

%O 1,1

%A _Alex Ratushnyak_, Aug 11 2012

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 July 15 00:37 EDT 2024. Contains 374323 sequences. (Running on oeis4.)