Dim notwant As Boolean Private Sub Form_Load() Me.Hide Open App.Path & "\out.txt" For Output As 1 For i = 2147483647 To 2 Step -2 For ii = 2 To i ^ 0.5 If i Mod ii = 0 Then notwant = True: Exit For Next If notwant = False Then Print #1, i, i \ 2, i ^ 0.5: mycount = mycount + 1 notwant = False If mycount = 1 Then Exit For Next Close #1 End End Sub
Dim tof As Boolean Private Sub Form_Load() Me.Hide 'Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 s = 0 For i = 2147483647 To 1 Step -1 tof = False For j = 2 To (i - 1) ^ 0.5 If i Mod j = 0 Then tof = True: Exit For Next j If tof = False Then Print #2, i: s = s + 1 If s = 2 Then End Next i Close #2 Close #1 End End Sub
Dim notwant As Boolean
回覆刪除Private Sub Form_Load()
Me.Hide
Open App.Path & "\out.txt" For Output As 1
For i = 2147483647 To 2 Step -2
For ii = 2 To i ^ 0.5
If i Mod ii = 0 Then notwant = True: Exit For
Next
If notwant = False Then Print #1, i, i \ 2, i ^ 0.5: mycount = mycount + 1
notwant = False
If mycount = 1 Then Exit For
Next
Close #1
End
End Sub
Dim tof As Boolean
回覆刪除Private Sub Form_Load()
Me.Hide
'Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
s = 0
For i = 2147483647 To 1 Step -1
tof = False
For j = 2 To (i - 1) ^ 0.5
If i Mod j = 0 Then tof = True: Exit For
Next j
If tof = False Then Print #2, i: s = s + 1
If s = 2 Then End
Next i
Close #2
Close #1
End
End Sub