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.
%I A343423 #19 Jun 19 2021 15:03:32 %S A343423 2,3,5,7,11,29,31,59,89,127,131,157,191,193,223,227,251,257,409,521, %T A343423 719,757,797,809,877,881,967,971,1009,1013,1049,1087,1091,1117,1123, %U A343423 1277,1301,1361,1409,1423,1447,1451,1523,1531,1657,1693,1697,1699,5273,5323 %N A343423 Prime numbers p such that Euclidean distance from origin to p in hexagonal grid sets a new record. Number '1' is placed at the origin and '2' at (1, 0). Number 'm' (m >= 3) is placed by moving one unit forward in the direction from 'm-2' to 'm-1', if m - 1 is not a prime; otherwise, making 1/6 turn counterclockwise at 'm-1' followed by moving one unit forward. %e A343423 Hexagonal grid with integers up to 85: %e A343423 29<---28<---27<---26<-7,25<=6,24<==5/23 %e A343423 / / \\ %e A343423 30 8 4/22 %e A343423 / / \\ %e A343423 31,53<-52<---51<---50<--9,49<--48<---47 3,21 %e A343423 / \ / \ / \ %e A343423 54 32 10 1,46--->2 20 %e A343423 / \ / \ \ %e A343423 55,79<--78<-33,77<--76<-11,75<--74<---73 45 19 %e A343423 // \ \ \ \ / %e A343423 56,80 34 12 72 44 18 %e A343423 // \ \ \ / \ / %e A343423 57,81 35 13--->14->15,71-->16-->17,43 %e A343423 // \ / / %e A343423 58,82 36 70 42 %e A343423 // \ / / %e A343423 59,83 37--->38->39,69-->40--->41 %e A343423 \\ / %e A343423 60,84 68 %e A343423 \\ / %e A343423 61,85--->62--->63--->64--->65--->66--->67 %e A343423 Prime number (p), square of the distance (s) from p to origin, and index (n) in the sequence for p up to 71 are: %e A343423 p: 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 %e A343423 s: 1 3 7 9 13 13 9 7 7 37 43 31 19 9 1 43 109 109 43 7 %e A343423 n: 1 2 3 4 5 -- -- -- -- 6 7 -- -- -- -- -- 8 -- -- -- %o A343423 (Python) %o A343423 from sympy import isprime %o A343423 dx = [2, 1, -1, -2, -1, 1]; dy = [0, 1, 1, 0, -1, -1] %o A343423 x = 0; y = 0; rec = 0; d = 0 %o A343423 for n in range(2, 10001): %o A343423 if isprime(n-1) == 1: d += 1; d %= 6 %o A343423 x += dx[d]; y += dy[d]; s = x*x + 3*y*y %o A343423 if isprime(n) == 1 and s > rec: print(n); rec = s %Y A343423 Cf. A113519, A257745, A309755, A335916. %K A343423 nonn %O A343423 1,1 %A A343423 _Ya-Ping Lu_, Apr 15 2021