FUNCTION IsSupperPrime
PARAMETERS nNum
PRIVATE nNum,nNum1,cNum,nCnt,lIsSupperPrime
IF SUBSTR(ALLTRIM(STR(nNum)),1,1)$"14689"
RETURN .F. &&若数值最高位不为2,3,5,7之一,则判定该数不为超级素数
ENDIF
FOR nCnt=0 TO LEN(ALLTRIM(STR(nNum)))-2
nNum1=INT(nNum/10^nCnt) &&将原数去掉从个位开始的nCnt位
cNum=SUBSTR(ALLTRIM(STR(nNum1)),2) &&提取除高位外的其余部分
IF "0"$cNum OR "2"$cNum OR "4"$cNum OR "5"$cNum OR "6"$cNum OR "8"$cNum
RETURN .F. &&要判断的数除高位外其余数值中含有0,2,4,5,6,8之一,则判定不为素数
ENDIF
IF IsPrime(nNum1)=.F.
RETURN .F. &&去掉nCnt位后不为素数,则判定不为超级素数
ENDIF
ENDFOR
RETURN .T.
*** EOF(): IsSupperPrime By Tiger5392 (C)Copyright 2006-2006
FUNCTION IsPrime
PARAMETERS nNumber
PRIVATE nNumber,nCnt
FOR nCnt=2 TO SQRT(nNumber)
IF nNumber%nCnt=0
RETURN .F.
ENDIF
ENDFOR
RETURN .T.
*** EOF(): IsPrime By Tiger5392 (C)Copyright 2006-2006