%N Rearrangement of primes so that sum of the absolute value of the successive differences is also a prime.
%C The smallest previously unused prime consistent with the definition is used at each step. - _Franklin T. Adams-Watters_, Oct 09 2006
%H Robert Israel, <a href="/A094744/b094744.txt">Table of n, a(n) for n = 1..10000</a>
%e 5-2 = 3 is prime, (5-2)+ (5-3) = 5 is a prime,(5-2)+(5-3)+(11-3) = 13 is a prime.
%p N:= 10000: # to use primes up to N
%p A:= 2:
%p P:= select(isprime, [seq(i,i=3..N,2)]):
%p s:= 0:
%p for n from 2 do
%p for i from 1 to nops(P) do
%p if isprime(s + abs(P[i]-A[n-1])) then
%p s:= s+abs(P[i]-A[n-1]);
%p A[n]:= P[i];
%p P:= subsop(i=NULL,P);
%p if not assigned(A[n]) then break fi;
%p seq(A[i],i=1..n-1); # _Robert Israel_, Sep 16 2016
%Y Cf. A094743, A094745.
%A _Amarnath Murthy_, May 24 2004
%E Corrected and extended by _Franklin T. Adams-Watters_, Oct 09 2006