5 ONERRORGOTO500
10 MODE8:DIM:c$=CHR$(5)
20 CLS:PRINT"Jn(x) (0≤n≤9,0≤x≤30)";
30 LOCATE0,1:PRINTc$;"n? :x? :J=";
40 LOCATE2,1:INPUT@3;n$:LOCATE0,0:n=VALF(LEFT$(n$,3)):u=ABSn:IFn<0 ORu>=10 ORFRACu<>0 THEN400
60 LOCATE8,1:INPUT@6;x$:LOCATE0,0:x=VALF(LEFT$(x$,6)):v=ABSx:IFx<0 ORv>30 THEN410
80 LOCATE17,1:PRINT" .....";:GOSUB200
100 IFn<0 THENr=r*(-1)^u
110 IFr<>0 ANDABSr>=1e-90 THENr=ROUND(r,LOG(ABSr)-7)
115 IFr<>0 ANDABSr<1e-90 THENr=r*1e10:r=ROUND(r,LOG(ABSr)-7):r=r/1e10
120 LOCATE18,1:PRINT" ";:LOCATE17,1:PRINTr;:z$=INPUT$(1,@):GOTO30
200 IFv+u=0 THENr=1:RETURN
210 IFv=0 THENr=0:RETURN
220 k=INT(1+3*v^(1/12)+9*v^(1/3)+(ABS(u-v)+ABS(u+v))/2)
230 s=0:b=1.5:c=0
240 a=2*k/x*b-c:k=k-1
250 IFk=u THENr=a
260 IFk=0 THEN290
270 IF(k MOD 2)=0 THENs=s+a
280 c=b:b=a:GOTO240
290 s=2*s+a:r=r/s
300 RETURN
400 LOCATE2,1:PRINT" ";:GOTO40
410 LOCATE8,1:PRINT" ";:GOTO60
500 IFERR=1 THENCLS:ONERRORGOTO0
510 IFERL=40 THENRESUME400
520 IFERL=60 THENRESUME410
530 LOCATE17,1:PRINT"not found";:z$=INPUT$(1,@):RESUME20