一个自然数倒过来读仍是这个数,就叫回文数,有些回文数还是素数,就叫回文式素数,如93239。以下程序用于

2024-12-15 08:11:06
推荐回答(3个)
回答1:

从m到n 间的回文素数

dim m,n,p,l,y,j,k as integer
dim a(100) as integer
FOR j = m TO n
p = 0
FOR k = 2 TO INT(SQR(j))
IF j / k = j \ k THEN p = 1
NEXT k
IF j = 1 THEN p = 1
IF p = 0 THEN
y = j
l = 0
DO
l = l + 1
a(l) = y MOD 10
y = y \ 10
LOOP WHILE y > 0
FOR k = 1 TO l \ 2
IF a(k) <> a(l + 1 - k) THEN p = 1
NEXT k
IF p = 0 THEN msgbox(j)
END IF
NEXT j

回答2:

依次填上
mid(m,4,1)
right(m,1)
m mod i=0
ss=f
hw(m) and ss(m)

回答3:

把问题写全了