I just noticed a *very* annoying difference between interpreter and
compiler:
rabinProvesCompositeSmall(p,n,nm1,q,k) ==
-- probability n prime is > 3/4 for each iteration
-- for most n this probability is much greater than 3/4
t := powmod(p, q, n)
-- neither of these cases tells us anything
-- if not (one? t or t = nm1) then
if not ((t = 1) or t = nm1) then
for j in 1..k-1 repeat
print(concat("check j ", string(j)$String)::OutputForm)
oldt := t
t := mulmod(t, t, n)
-- one? t => return true
(t = 1) => return true
-- we have squared someting not -1 and got 1
t = nm1 =>
print "leaving"
leave
print "check t = -1 after loop"
not (t = nm1) =>
print "t = -1 after loop"
return true
print "after t = 1 or t = -1"
false
(80) -> rabinProvesCompositeSmall(2,41,40,5,3)$PRIMES INT
1<enter IntegerPrimesPackage.rabinProvesCompositeSmall,51
:
arg1= 2
arg2= 41
arg3= 40
arg4= 5
arg5= 3
"check j 1"
leaving
check t = -1 after loop
after t = 1 or t = -1
1>exit IntegerPrimesPackage.rabinProvesCompositeSmall,51
:
false
(80) false
Type: Boolean
(79) -> rabinProvesCompositeSmall(2,41,40,5,3)
"check j 1"
"leaving"
"check j 2"
(79) true
Type: Boolean
is this known? difficult to fix?
Martin
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en.