Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #7 Dec 04 2024 09:12:24
%S 3,5,17,29,41,71,101,191,281,311,617,857,1319,1451,1481,1721,2027,
%T 2267,2729,2969,2999,3461,3767,4229,4241,4271,20021,22091,22961,23201,
%U 23291,27581,31121,31151,31181,32441,32531,32561,32801,32831,33071,33827,35897
%N 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.
%F The terms on the NE spoke are given by a(n - 1) + 4*k^2 - 2*k for k >= 1.
%e Spiral for a(2)=5:
%e 21 20 19 18 17
%e 22 .9 .8 .7 16
%e 23 10 .5 .6 15
%e 24 11 12 13 14
%e 25 26 27 28 29
%e 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.
%o (PARI) twinp(p) = if(isprime(p) && isprime(p + 2),1,0);
%o ulamNW(p, k) = p + 4*k^2-2*k;
%o 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
%Y Cf. A001359, A054554, A163633.
%K nonn
%O 1,1
%A Milton L. Brown (miltbrown(AT)earthlink.net), Jul 31 2009
%E Edited by _Georg Fischer_, Dec 03 2024