```begin;
comment  JAZ164, R743, Outer Planets
;
integer K, T;
real A, K2, X;
Boolean FI;
array Y, YA, Z, ZA[1 : 15], M[0 : 5], E[1 : 60], D[1 : 33];
array OWND[1 : 5, 1 : 5], OWNR[1 : 5];
real procedure F(K);
integer K;
begin;
integer I, J, I3, J3;
real P;
if K  1 then goto A;
for I := 1 step 1 until 4 do
begin;
I3 := 3  I;
for J := I + 1 step 1 until 5 do
begin;
J3 := 3  J;
P := (Y[I3 - 2] - Y[J3 - 2])  2 + (Y[I3 - 1] - Y[J3 - 1])  2 + (Y[I3] - Y[J3])  2;
OWND[I, J] := OWND[J, I] := 1 ÷ P ÷ SQRT(P);
end ;
end ;
for I := 1 step 1 until 5 do
begin;
I3 := 3  I;
OWND[I, I] := 0;
P := Y[I3 - 2]  2 + Y[I3 - 1]  2 + Y[I3]  2;
OWNR[I] := 1 ÷ P ÷ SQRT(P);
end ;
A: I := (K - 1) ÷ 3 + 1;
F := K2  (-M[0]  Y[K]  OWNR[I] + SUM(J, 1, 5, M[J]  ((Y[3  (J - I) + K] - Y[K])  OWND[I, J] - Y[3  (J - I) + K]  OWNR[J])));
end F;
procedure RK3N(X, A, B, Y, YA, Z, ZA, FXYJ, J, E, D, FI, N);
value B, FI, N;
integer J, N;
real X, A, B, FXYJ;
Boolean FI;
array Y, YA, Z, ZA, E, D;
begin;
integer JJ;
real XL, H, HMIN, INT, HL, ABSH, FHM, DISCRY, DISCRZ, TOLY, TOLZ, MU, MU1, FHY, FHZ;
Boolean LAST, FIRST, REJECT;
array YL, ZL, K0, K1, K2, K3, K4, K5[1 : N], EE[1 : 4  N];
if FI then begin;
D[3] := A;
for JJ := 1 step 1 until N do
begin;
D[JJ + 3] := YA[JJ];
D[N + JJ + 3] := ZA[JJ];
end ;
end ;
D[1] := 0;
XL := D[3];
for JJ := 1 step 1 until N do
begin;
YL[JJ] := D[JJ + 3];
ZL[JJ] := D[N + JJ + 3];
end ;
if FI then D[2] := B - D[3];
ABSH := H := ABS(D[2]);
if B - XL < 0 then H := -H;
INT := ABS(B - XL);
HMIN := INT  E[1] + E[2];
for JJ := 2 step 1 until 2  N do
begin;
HL := INT  E[2  JJ - 1] + E[2  JJ];
if HL < HMIN then HMIN := HL;
end ;
for JJ := 1 step 1 until 4  N do
EE[JJ] := E[JJ] ÷ INT;
FIRST := REJECT := true;
if FI then begin;
LAST := true;
goto STEP;
end ;
TEST: ABSH := ABS(H);
if ABSH < HMIN then begin;
H := if H > 0 then HMIN else -HMIN;
ABSH := HMIN;
end ;

* Syntax error at: ifH>B-XL=H>0thenbegin;

D[2] := H;
LAST := true;
H := B - XL;
ABSH := ABS(H);
end  else LAST := false;
STEP: if REJECT then begin;
X := XL;
for JJ := 1 step 1 until N do
Y[JJ] := YL[JJ];
for J := 1 step 1 until N do
K0[J] := FXYJ  H;
end  else begin;
FHY := H ÷ HL;
for JJ := 1 step 1 until N do
K0[JJ] := K5[JJ]  FHY;
end ;
X := XL + .276393202250021  H;
for JJ := 1 step 1 until N do
Y[JJ] := YL[JJ] + (ZL[JJ]  .276393202250021 + K0[JJ]  .038196601125011)  H;
for J := 1 step 1 until N do
K1[J] := FXYJ  H;
X := XL + .723606797749979  H;
for JJ := 1 step 1 until N do
Y[JJ] := YL[JJ] + (ZL[JJ]  .723606797749979 + K1[JJ]  .261803398874989)  H;
for J := 1 step 1 until N do
K2[J] := FXYJ  H;
X := XL + H  .5;
for JJ := 1 step 1 until N do
Y[JJ] := YL[JJ] + (ZL[JJ]  .5 + K0[JJ]  .046875 + K1[JJ]  .079824155839840 - K2[JJ]  .001699155839840)  H;
for J := 1 step 1 until N do
K4[J] := FXYJ  H;
X := if LAST then B else XL + H;
for JJ := 1 step 1 until N do
Y[JJ] := YL[JJ] + (ZL[JJ] + K0[JJ]  .309016994374947 + K2[JJ]  .190983005625053)  H;
for J := 1 step 1 until N do
K3[J] := FXYJ  H;
for JJ := 1 step 1 until N do
Y[JJ] := YL[JJ] + (ZL[JJ] + K0[JJ]  .083333333333333 + K1[JJ]  .301502832395825 + K2[JJ]  .115163834270842)  H;
for J := 1 step 1 until N do
K5[J] := FXYJ  H;
REJECT := false;
FHM := 0;
for JJ := 1 step 1 until N do
begin;
DISCRY := ABS((-K0[JJ]  .5 + K1[JJ]  1.809016994374947 + K2[JJ]  .690983005625053 - K4[JJ]  2)  H);
DISCRZ := ABS((K0[JJ] - K3[JJ])  2 - (K1[JJ] + K2[JJ])  10 + K4[JJ]  16 + K5[JJ]  4);
TOLY := ABSH  (ABS(ZL[JJ])  EE[2  JJ - 1] + EE[2  JJ]);
TOLZ := ABS(K0[JJ])  EE[2  (JJ + N) - 1] + ABSH  EE[2  (JJ + N)];
REJECT := DISCRY > TOLY  DISCRZ > TOLZ  REJECT;
FHY := DISCRY ÷ TOLY;
FHZ := DISCRZ ÷ TOLZ;
if FHZ > FHY then FHY := FHZ;
if FHY > FHM then FHM := FHY;
end ;
MU := 1 ÷ (1 + FHM) + .45;
if REJECT then begin;
if ABSH < HMIN then begin;
D[1] := D[1] + 1;
for JJ := 1 step 1 until N do
begin;
Y[JJ] := YL[JJ];
Z[JJ] := ZL[JJ];
end ;
FIRST := true;
goto NEXT;
end ;
H := MU  H;
goto TEST;
end REJ;
if FIRST then begin;
FIRST := false;
HL := H;
H := MU  H;
goto ACC;
end ;
FHY := MU  H ÷ HL + MU - MU1;
HL := H;
H := FHY  H;
ACC: MU1 := MU;
for JJ := 1 step 1 until N do
Z[JJ] := ZL[JJ] + (K0[JJ] + K3[JJ])  .083333333333333 + (K1[JJ] + K2[JJ])  .416666666666667;
NEXT: if B  X then begin;
XL := X;
for JJ := 1 step 1 until N do
begin;
YL[JJ] := Y[JJ];
ZL[JJ] := Z[JJ];
end ;
goto TEST;
end ;
if ¬LAST then D[2] := H;
D[3] := X;
for JJ := 1 step 1 until N do
begin;
D[JJ + 3] := Y[JJ];
D[N + JJ + 3] := Z[JJ];
end ;
end RK3N;
procedure TYP(X);
array X;
begin;
integer K;
NLCR;
PRINTTEXT("T = ");
ABSFIXT(7, 1, T + A);
NLCR;
NLCR;
for K := 1 step 1 until 5 do
begin;
if K = 1 then PRINTTEXT("J ") else if K = 2 then PRINTTEXT("S ") else if K = 3 then PRINTTEXT("U ") else if K = 4 then PRINTTEXT("N ") else PRINTTEXT("P ");
FIXT(2, 9, X[3  K - 2]);
FIXT(2, 9, X[3  K - 1]);
FIXT(2, 9, X[3  K]);
NLCR;
end ;
end TYP;
real procedure SUM(I, A, B, XI);
value B;
integer I, A, B;
real XI;
begin;
real S;
S := 0;
for I := A step 1 until B do
S := S + XI;
SUM := S;
end SUM;
for K := 1 step 1 until 15 do
begin;
end ;
for K := 0 step 1 until 5 do
for K := 2 step 1 until 60 do
E[K] := E[1];
NLCR;
PRINTTEXT("JAZ164, R743, Outer Planets");
NLCR;
NLCR;
for K := 1 step 1 until 15 do
begin;
FLOT(12, 2, YA[K]);
FLOT(12, 2, ZA[K]);
NLCR;
end ;
for K := 0 step 1 until 5 do
begin;
NLCR;
FLOT(12, 2, M[K]);
end ;
NLCR;
NLCR;
FLOT(12, 2, K2);
NLCR;
NLCR;
PRINTTEXT("eps = ");
FLOT(2, 2, E[1]);
NLCR;
T := 0;
TYP(YA);
FI := true;
for T := 500,
1000 do
begin;
RK3N(X, 0, T, Y, YA, Z, ZA, F(K), K, E, D, FI, 15);
FI := false;
TYP(Y);
end ;
end;
```