cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A094744 Rearrangement of primes so that sum of the absolute value of the successive differences is also a prime.

This page as a plain text file.
%I A094744 #9 Sep 17 2016 00:21:07
%S A094744 2,5,3,11,7,13,19,17,23,29,47,37,67,31,43,41,53,71,59,89,61,73,79,103,
%T A094744 83,101,107,97,109,139,127,157,131,137,113,149,167,151,163,181,193,
%U A094744 173,197,179,191,227,251,211,277,229,271,223,307,239,263,199,241,283,257
%N A094744 Rearrangement of primes so that sum of the absolute value of the successive differences is also a prime.
%C A094744 The smallest previously unused prime consistent with the definition is used at each step. - _Franklin T. Adams-Watters_, Oct 09 2006
%H A094744 Robert Israel, <a href="/A094744/b094744.txt">Table of n, a(n) for n = 1..10000</a>
%e A094744 5-2 = 3 is prime, (5-2)+ (5-3) = 5 is a prime,(5-2)+(5-3)+(11-3) = 13 is a prime.
%p A094744 N:= 10000: # to use primes up to N
%p A094744 A[1]:= 2:
%p A094744 P:= select(isprime, [seq(i,i=3..N,2)]):
%p A094744 s:= 0:
%p A094744 for n from 2   do
%p A094744   for i from 1 to nops(P) do
%p A094744     if isprime(s + abs(P[i]-A[n-1])) then
%p A094744       s:= s+abs(P[i]-A[n-1]);
%p A094744       A[n]:= P[i];
%p A094744       P:= subsop(i=NULL,P);
%p A094744       break
%p A094744     fi
%p A094744   od;
%p A094744   if not assigned(A[n]) then break fi;
%p A094744 od:
%p A094744 seq(A[i],i=1..n-1); # _Robert Israel_, Sep 16 2016
%Y A094744 Cf. A094743, A094745.
%K A094744 nonn
%O A094744 1,1
%A A094744 _Amarnath Murthy_, May 24 2004
%E A094744 Corrected and extended by _Franklin T. Adams-Watters_, Oct 09 2006