OPTION BASE 0 LET LEVEL=100 LET KETA=6 DIM A$(KETA-1),B$(50) INPUT PROMPT "N進法(3 - 50) =":N FOR I=0 TO N-1 IF MOD(N,2)=1 THEN IF (N-1)/2<I THEN LET B$(I)=STR$(I-N) ELSE LET B$(I)=" " & STR$(I) END IF ELSE IF N/2+1<=I THEN LET B$(I)=STR$(I-N) ELSE LET B$(I)=" " & STR$(I) END IF END IF NEXT I FOR I=0 TO KETA-1 LET A$(I)=" 0" NEXT I FOR I=1 TO LEVEL LET A$(0)=B$(MOD(I,N)) LET L=1 FOR K=1 TO KETA-1 IF MOD(N,2)=1 THEN LET L=L*N-(N-1)/2 ELSE LET L=L*N-(N/2-1) IF I>=L THEN LET J=MOD(INT((I-L)/(N^K)+1),N) LET A$(K)=B$(J) END IF NEXT K PRINT RIGHT$(" "&STR$(I),LEN(STR$(LEVEL)));": "; FOR K=KETA-1 TO 0 STEP -1 PRINT A$(K);" "; NEXT K PRINT NEXT I END
|