A345293 a(n) is the first number on the n-th layer in a layered square spiral of primes.
2, 73, 149, 211, 307, 467, 659, 839, 1061, 1319, 1511, 1697, 1949, 2129, 2381, 2677, 2819, 3137, 3307, 3407, 3559, 3907, 4079, 4253, 4591, 4877, 5087, 5443, 5531, 5683, 5923, 6221, 6659, 6791, 6997, 7393, 7603, 8111, 8297, 8641, 8887, 9029, 9377, 9461, 9749
Offset: 1
Keywords
Examples
First layer starts from 2 and second layer from 73. 59<--53<--47<--43<--41 | | 61 11<---7<---5 37 137<-131<-127<-113<-109<-107 | | | | | | 67 13 2--->3 31 139 103 | | | | 71 17-->19-->23-->29 73-->79-->83-->89-->97->101
Programs
-
Python
from sympy import prime, nextprime print(2); d1 = 0; L = [0, 0, 0]; L1 = [] for i in range(1, 1501): p = prime(i); np = nextprime(p); d = (d1 + 1)%4 if np - p == 2 else d1 L[0] += 1 if d == 0 else -1 if d == 2 else 0 L[1] += 1 if d == 1 else -1 if d == 3 else 0 if L in L1: L[2] += 1; print(np) L1.append([L[0], L[1], L[2]]); d1 = d
Comments