QuickStep commented on a Page, Prime numbers  -  Jul 05, 2005

2 things to note, which involves some understanding and math:
Note 1:
You let the loop go while \$calc(\$1 / 2) is larger than prime, you do this to avoid \'mirrage\' or the calculation (42=8, 24=8), but this is NOT the right check, especially when checking large numbers. When a number mirrages it means that n*n=answer, meaning you should check the square root, thats the point where the calculation turns around. So: \'while (%prime <= \$sqrt(\$1))\' OR \'while (%prime <= \$calc(\$1 ^ 0.5))\'
This can save some lag especially during large numbers

Note2:
To check if a number is a decimal number, you check if a dot is in the number. While this works and is correct in mIRC, it is not the way to go especially when doing the same script in other languages, because you are converting a float to string. To check if a number is a decimal number, i always use \'if (\$1 = \$int(\$1))\'

anyway sorry to be picky

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.