IsPrime

Checks to see if a number is a primary number. Prime numbers are commonly found in encryption schemes that use Public/Private keys.
By: Lewis Moten

Function IsPrime(ByRef pLngNumber)
 Dim lLngSquare, lLngIndex
 IsPrime = False
 if pLngNumber < 2 Then Exit function
 if pLngNumber Mod 2 = 0 Then Exit function
 lLngSquare = Sqr(pLngNumber)
 For lLngIndex = 3 To lLngSquare Step 2
  if pLngNumber Mod lLngIndex = 0 Then Exit function
 Next
 IsPrime = True
End function

pLngNumber

Views 972 Downloads 345

'Prime', 'calculation', 'calculate', 'compute', 'number', 'NotMyWork'

ANmarAmdeen
333
Math Classic ASP
Revisions

v1.0