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.

A309755 Primes with record Euclidean distance from the origin. When starting rightwards in a grid, turn left after a prime number, if not walk straight on.

This page as a plain text file.
%I A309755 #32 Oct 04 2019 13:32:38
%S A309755 2,3,11,29,59,97,149,151,191,193,211,223,239,263,281,307,311,331,337,
%T A309755 593,613,631,641,653,659,853,857,877,881,907,911,967,971,991,997,1801,
%U A309755 1811,1847,1861,1901,1907,2251,2267,2281,2287,2309,2311,2657,2671,2677,3163,3167,3187,3191,3299,3319,3343,3691,3697,3719,3727
%N A309755 Primes with record Euclidean distance from the origin. When starting rightwards in a grid, turn left after a prime number, if not walk straight on.
%C A309755 Cells can contain more than one number.
%C A309755 This sequence differs from A309701, where the Manhattan distance is taken.
%H A309755 Pieter Post, <a href="/A309755/b309755.txt">Table of n, a(n) for n = 1..182</a>
%e A309755 Grid of the first 34 steps. 0 (second cell in sixth row) represents (0,0).
%e A309755 ---
%e A309755 xx  xx   xx   31   30    29
%e A309755 xx  xx   xx   32   xx    28
%e A309755 xx  xx   xx   33   xx    27
%e A309755 xx  xx   xx   34   xx    26
%e A309755 xx 5/17 4/16 3/15  14   13/25
%e A309755 x 0/6/18  1    2   xx   12/24
%e A309755 xx 7/19 8/20 9/21 10/22 11/23
%e A309755 ---
%e A309755 2 (2,0) is two steps away from the origin, 3 (2,1) is at a distance of sqrt(5). Next record distance is 11 (4,-1), at distance sqrt(17). Next is 29 (4,5), at distance sqrt(41).
%t A309755 step[n_] := Switch[n, 0, {1, 0}, 1, {0, 1}, 2, {-1, 0}, 3, {0, -1}]; r = {0, 0}; q = 0; s={}; rm=0; Do[p = NextPrime[q]; r += step[Mod[n, 4]] * (p-q); r1 = Total @ (r^2); If[r1 > rm, rm = r1; AppendTo[s, p]]; q = p, {n, 0, 3000}]; s (* _Amiram Eldar_, Aug 15 2019 *)
%o A309755 (Python)
%o A309755 def prime(z):
%o A309755     isPrime=True
%o A309755     for y in range(2,int(z**0.5)+1) :
%o A309755         if z%y==0:
%o A309755             isPrime=False
%o A309755             break
%o A309755     return isPrime
%o A309755 m,n, g,h=[],[],[1,0,-1,0],[0,1,0,-1]
%o A309755 z=10000
%o A309755 for c in range (2,z):
%o A309755     if prime(c)==True:
%o A309755         m.append(c)
%o A309755 ca,cb,cc=2,0,0
%o A309755 for j in range(2,z):
%o A309755     if j in m:
%o A309755         cc=cc+1
%o A309755         cd,ce=g[cc%4],h[cc%4]
%o A309755     ca,cb=ca+cd,cb+ce
%o A309755     n.append([j+1,ca,cb,((ca)**2+(cb)**2)**(0.5)])
%o A309755     #print (j+1,ca,cb)
%o A309755 v=2
%o A309755 for j in n:
%o A309755     if j[3]>v and j[0] in m:
%o A309755         print (j)
%o A309755         v=j[3]
%o A309755 (PARI) z=0; d=1; m=0; for (n=1, 3727, z+=d; if (isprime(n), d*=I; if (m<norm(z), m=norm(z); print1 (n ", ")))) \\ _Rémy Sigrist_, Aug 15 2019
%Y A309755 Cf. A000040, A309701.
%K A309755 nonn
%O A309755 1,1
%A A309755 _Pieter Post_, Aug 15 2019