Function to create prime number
Syntax =PRIME(Starting Number, Ending Number)
Syntax =PRIME(Starting Number, Ending Number)
Private Function PRIME(St, En As Long)
Dim Ans As String
For x = St To En
For y = 2 To x - 1
If x Mod y = 0 Then GoTo 20:
Next y
Ans = Ans & x & ","
20:
Next x
PRIME = Ans
End Function
Link: ExcelForum
Update to verify a Prime:
=AND(MOD(A2;ROW(INDIRECT("2:"&INT(SQRT(A2))))))
Link: Chandoo.org
Inga kommentarer:
Skicka en kommentar