A163586 a(1) = 3. For n > 1, Ulam's spiral is started with a(n-1), and the primes p on the NE spoke are considered. a(n) is the minimal p that is the lesser of a twin prime pair.
3, 5, 17, 29, 41, 71, 101, 191, 281, 311, 617, 857, 1319, 1451, 1481, 1721, 2027, 2267, 2729, 2969, 2999, 3461, 3767, 4229, 4241, 4271, 20021, 22091, 22961, 23201, 23291, 27581, 31121, 31151, 31181, 32441, 32531, 32561, 32801, 32831, 33071, 33827, 35897
Offset: 1
Keywords
Examples
Spiral for a(2)=5: 21 20 19 18 17 22 .9 .8 .7 16 23 10 .5 .6 15 24 11 12 13 14 25 26 27 28 29 a(2)+4*k^2-2*k with k=1 is not taken since 7 is no lesser twin prime, but 17 (k=2) is.
Programs
-
PARI
twinp(p) = if(isprime(p) && isprime(p + 2),1,0); ulamNW(p, k) = p + 4*k^2-2*k; p = 1; for(n=1, 64, k=1; while (!twinp(ulamNW(p,k)), k++); p = ulamNW(p, k); print1(", ", p)) \\ Georg Fischer, Dec 03 2024
Formula
The terms on the NE spoke are given by a(n - 1) + 4*k^2 - 2*k for k >= 1.
Extensions
Edited by Georg Fischer, Dec 03 2024