[squeak-dev] Squeak 4.5 error: #isPrime fails with relatively small Mersenne prime

Lawson English lenglish5 at cox.net
Tue Feb 10 09:39:19 UTC 2015


This bit of code fails at numb := 1024:

error: Cannot truncate this number

numb := 1024.
1 to: numb do: [:n||test| test:=(2 raisedTo: n) -1. (test isPrime) 
ifTrue: [Transcript show: n; tab; show: test;cr]]

#isProbablyPrime fails with the same number.


numb := 1023.
works for both.





L

-- 
Squeak from the very start (introduction to Squeak and Pharo Smalltalk for the (almost) complete and compleate beginner).
https://www.youtube.com/playlist?list=PL6601A198DF14788D&feature=view_all

"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." - Brian Kernighan



More information about the Squeak-dev mailing list