%I #11 Dec 16 2019 02:19:14
%S 2,1,4,5,3,6,8,10,11,9,12,14,16,18,24,20,22,28,30,26,32,34,38,36,42,
%T 40,46,44,50,45,15,54,48,21,17,52,56,60,62,66,58,70,64,78,68,27,29,72,
%U 74,80,82,84,76,96,86,39,35,90,98,102,88,41,51,104,94,100
%N Lexicographically earliest sequence of distinct positive terms with an associate sequence t such that t(0) = 0, and for any n > 0, at least one of t(n-1) - a(n) or t(n-1) + a(n) is a prime number; in case t(n-1) - a(n) is a prime number, set t(n) = t(n-1) - a(n), otherwise set t(n) = t(n-1) + a(n).
%C This sequence is a variant of A330401.
%H Rémy Sigrist, <a href="/A330402/b330402.txt">Table of n, a(n) for n = 1..10000</a>
%H Rémy Sigrist, <a href="/A330402/a330402.gp.txt">PARI program for A330402</a>
%e The first terms, alongside t(n), are:
%e n a(n) t(n)
%e -- ---- ----
%e 0 N/A 0
%e 1 2 2
%e 2 1 3
%e 3 4 7
%e 4 5 2
%e 5 3 5
%e 6 6 11
%e 7 8 3
%e 8 10 13
%e 9 11 2
%e 10 9 11
%e 11 12 23
%e 12 14 37
%o (PARI) See Links section.
%Y Cf. A330401, A330421 (running totals).
%K nonn
%O 1,1
%A _Rémy Sigrist_, Dec 13 2019