login
a(1) = 1 and then distinct numbers such that the sum as well the absolute difference of successive terms is a prime.
2

%I #16 Oct 18 2022 13:49:50

%S 1,4,7,10,3,8,5,2,9,14,17,6,11,18,13,16,21,26,15,22,19,12,25,28,31,36,

%T 23,20,27,32,29,24,35,38,33,40,43,30,37,34,39,44,57,46,51,56,45,52,49,

%U 54,47,42,55,48,41,60,53,50,63,68,71,66,61,78,59,72,65,62,69,58,81,70

%N a(1) = 1 and then distinct numbers such that the sum as well the absolute difference of successive terms is a prime.

%C Another rearrangement of natural numbers in which a(2k) is even and a(2k+1) is odd.

%e 17 follows 14 as 14+17 =31 and 17-14 = 3 both are prime and 17 is smallest such number not occurring earlier.

%t s = {m = 1}; Do[n = 2; While[MemberQ[s, n] || ! PrimeQ[n - m] || ! PrimeQ[n + m], n++]; m = n; AppendTo[s, m = n], {100}]; s (* _Zak Seidov_, Oct 18 2022 *)

%Y Cf. A084037, A084038.

%K nonn

%O 1,2

%A _Amarnath Murthy_, May 26 2003

%E More terms from _Ray Chandler_, Jun 09 2003