ISPRIME
ISPRIME(lNumber)
Returns the
| lNumber |
REMARKS
As an excel formula
=NOT(OR(MOD(A1,SEQUENCE(ROUNDDOWN(SQRT(A1),0)-1,,2))=0))
Public Function ISPRIME( _
ByVal lNumber As Long) _
As Boolean
Dim i As Long
ISPRIME = True
For i = 2 To Application.RoundDown(Math.Sqr(lNumber), 0)
If (lNumber Mod i = 0) Then
ISPRIME = False
Exit For
End If
Next i
End Function
© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext