题目
一个自然数倒过来读仍是这个数,就叫回文数,有些回文数还是素数,就叫回文式素数,如93239.以下程序用于
请补充完善程序.
Function hw(m As Long) As Boolean
Dim a As Integer, b As Integer, c As Integer, d As Integer
a = Left(m, 1): b = Mid(m, 2, 1)
c = _____________________
d = _____________________
hw = IIf(a = d And b = c, True, False)
End Function
Function ss(m As Long) As Boolean
Dim k As Long, i As Long, f As Boolean
f=True
k = Sqr(m)
For i = 2 To k
If _____________________ Then
f = False
Exit For
End If
Next i
________________
End Function
Private Sub Command1_Click()
Dim m As Long, n As Integer
For m = 10000 To 99999
If _____________________________ Then
Print Tab((n Mod 10) * 8 + 1); m;
n = n + 1
End If
Next m
End Sub
Mid(m,4,1) Right(m,1) 注意:只要能取出第四、五位即可得分
m mod i=0(只要能判断整除即可
请补充完善程序.
Function hw(m As Long) As Boolean
Dim a As Integer, b As Integer, c As Integer, d As Integer
a = Left(m, 1): b = Mid(m, 2, 1)
c = _____________________
d = _____________________
hw = IIf(a = d And b = c, True, False)
End Function
Function ss(m As Long) As Boolean
Dim k As Long, i As Long, f As Boolean
f=True
k = Sqr(m)
For i = 2 To k
If _____________________ Then
f = False
Exit For
End If
Next i
________________
End Function
Private Sub Command1_Click()
Dim m As Long, n As Integer
For m = 10000 To 99999
If _____________________________ Then
Print Tab((n Mod 10) * 8 + 1); m;
n = n + 1
End If
Next m
End Sub
Mid(m,4,1) Right(m,1) 注意:只要能取出第四、五位即可得分
m mod i=0(只要能判断整除即可
提问时间:2020-08-07
答案
从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
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
举一反三
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
1,人们染上烟瘾,最终因吸烟使自己丧命.
最新试题
热门考点
- 1怎样快速配平化学式?
- 2初中英语时态练习
- 3已知a的平方+b的平方+2a-6b+10=0求2a+4b-3的值
- 4文文和亮亮分别打一份6000字和4000字的文件文文打6个字的时间亮亮能打5个.亮亮打完比文文少用2分钟 求文文
- 5an=2n,n为奇数,2^n,n为偶数,求此数列的前n项和Sn
- 6(请把jacket拼写出来)翻译成英语
- 7f1f2f3作用在同一物体上,物体处于平衡状态.若其中的f1逐渐减小,物体所受合力()
- 8为什么早晨温度低中午温度高?
- 9甲对乙说:“我像你这样大岁数的时候,你的岁数是我今年岁数的一半,当你到我这样大岁数的时候,我的岁数比你今年岁数的2倍少7岁,”两人现年各是多少岁?用一元一次方程解,
- 10糖类、脂肪和蛋白质在动物体内氧化分解后,最终形成的物质都是二氧化碳和水