|
Lychrel number(回文数に収束しない数)
INPUT N !' N=196,295,394,493,592,689,691,788,790,879,887,978,986...
DO
LET NUM=NUM+1
LET K=REVERSE(N)
PRINT NUM;":";N;"+";K;"=";N+K
LET N=N+K
LOOP UNTIL N=REVERSE(N) OR NUM>=300
END
EXTERNAL FUNCTION REVERSE(X)
DO
LET N=MOD(X,10)
LET Y=Y*10+N
LET X=INT(X/10)
LOOP UNTIL X=0
LET REVERSE=Y
END FUNCTION
|
|