[squeak-dev] Integer>>isPrime why reverting Knuth's algorithm P (probabilistic primality test) with iteration over division with even numbers?

Cédrick Béler cdrick65 at gmail.com
Sat Dec 19 22:11:47 UTC 2009


isLargeIntPrime  for the Knuth version

isSmallIntPrime for the "determinitic" version


isPrime

self < 100000 "or the actual limit...maybe SmallInter maxVal  1073741823"
   ifTrue: [^self isSmallIntPrime]
   ifFalse: [^self isLargeIntPrime]


my 2 cents... :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20091219/238b41cb/attachment.htm


More information about the Squeak-dev mailing list