主题:[活动]回文素数
神鬼天王
[专家分:30] 发布于 2009-09-19 13:01:00
N~M的回文素数
回复列表 (共2个回复)
沙发
phile [专家分:2310] 发布于 2009-09-19 13:02:00
CLS
INPUT N
FOR I = 11 TO N
F = 0
FOR J = 2 TO INT(SQR(I))
IF I MOD J = 0 THEN F = 1: EXIT FOR
NEXT J
IF F = 0 THEN
P = I
K = 0
DO
K = K + 1
A(K) = P MOD 10
P = P \ 10
LOOP UNTIL P = 0
T = 0
FOR J = 1 TO K
IF A(J) <> A(K + 1 - J) THEN T = 1
NEXT J
IF T = 0 THEN PRINT I; " ";
END IF
NEXT I
板凳
phile [专家分:2310] 发布于 2009-09-19 13:02:00
利用循环嵌套
我来回复