help im trying to output prime and coprime AND NEITHER DEPENDING ON THE NUMBERand its not working
i have been trying for hours and its not working
swift help would be appreciated
Function IsPrime(TestPrime As Long)
Dim TestNum As Long
Dim checkPrime As Boolean
Dim TestLimit As Long
If TestPrime Mod 2 = 0 Then Exit Function
TestNum = 3
TestLimit = TestPrime
Do While TestLimit > TestNum
If TestPrime Mod TestNum = 0 Then
Exit Function
End If
TestLimit = TestPrime \ TestNum
TestNum = TestNum + 2
Loop
checkPrime = True
If checkPrime = True Then
IsPrime = "prime"
Else: IsPrime = "coprime"
End If
If TestPrime = 1 Then
IsPrime = "neither"
End If
End Function
Bookmarks