Some aids for writing procedures
Here are a few Maple commands that may be of use.
Setting printlevel to 10 will force Maple to print out intermediate data computed within a given procedure. Setting it to 20 will also printout data in procedures called by the given procedure.
> printlevel := 1;
> goodprimelist(10,50);
> printlevel := 20;
> goodprimelist(10,50);
{--> enter goodprimelist, args = 10, 50
value remembered (in goodprimelist): isprime(10) -> false
value remembered (in goodprimelist): isprime(11) -> true
{--> enter goodprime, args = 11
<-- exit goodprime (now in goodprimelist) = true}
value remembered (in goodprimelist): isprime(12) -> false
value remembered (in goodprimelist): isprime(13) -> true
{--> enter goodprime, args = 13
<-- exit goodprime (now in goodprimelist) = false}
value remembered (in goodprimelist): isprime(14) -> false
value remembered (in goodprimelist): isprime(15) -> false
value remembered (in goodprimelist): isprime(16) -> false
value remembered (in goodprimelist): isprime(17) -> true
{--> enter goodprime, args = 17
<-- exit goodprime (now in goodprimelist) = false}
value remembered (in goodprimelist): isprime(18) -> false
value remembered (in goodprimelist): isprime(19) -> true
{--> enter goodprime, args = 19
<-- exit goodprime (now in goodprimelist) = false}
value remembered (in goodprimelist): isprime(20) -> false
value remembered (in goodprimelist): isprime(21) -> false
value remembered (in goodprimelist): isprime(22) -> false
value remembered (in goodprimelist): isprime(23) -> true
{--> enter goodprime, args = 23
<-- exit goodprime (now in goodprimelist) = true}
value remembered (in goodprimelist): isprime(24) -> false
value remembered (in goodprimelist): isprime(25) -> false
value remembered (in goodprimelist): isprime(26) -> false
value remembered (in goodprimelist): isprime(27) -> false
value remembered (in goodprimelist): isprime(28) -> false
value remembered (in goodprimelist): isprime(29) -> true
{--> enter goodprime, args = 29
<-- exit goodprime (now in goodprimelist) = false}
value remembered (in goodprimelist): isprime(30) -> false
value remembered (in goodprimelist): isprime(31) -> true
{--> enter goodprime, args = 31
<-- exit goodprime (now in goodprimelist) = false}
value remembered (in goodprimelist): isprime(32) -> false
value remembered (in goodprimelist): isprime(33) -> false
value remembered (in goodprimelist): isprime(34) -> false
value remembered (in goodprimelist): isprime(35) -> false
value remembered (in goodprimelist): isprime(36) -> false
value remembered (in goodprimelist): isprime(37) -> true
{--> enter goodprime, args = 37
<-- exit goodprime (now in goodprimelist) = false}
value remembered (in goodprimelist): isprime(38) -> false
value remembered (in goodprimelist): isprime(39) -> false
value remembered (in goodprimelist): isprime(40) -> false
value remembered (in goodprimelist): isprime(41) -> true
{--> enter goodprime, args = 41
<-- exit goodprime (now in goodprimelist) = false}
value remembered (in goodprimelist): isprime(42) -> false
value remembered (in goodprimelist): isprime(43) -> true
{--> enter goodprime, args = 43
<-- exit goodprime (now in goodprimelist) = false}
value remembered (in goodprimelist): isprime(44) -> false
value remembered (in goodprimelist): isprime(45) -> false
value remembered (in goodprimelist): isprime(46) -> false
value remembered (in goodprimelist): isprime(47) -> true
{--> enter goodprime, args = 47
<-- exit goodprime (now in goodprimelist) = true}
value remembered (in goodprimelist): isprime(48) -> false
value remembered (in goodprimelist): isprime(49) -> false
value remembered (in goodprimelist): isprime(50) -> false
<-- exit goodprimelist (now at top level) = [11, 23, 47]}
Another interesting thing is to look at the Maple code for some of the functions that you use.
The rather cryptic command sequence is to set verboseproc =2 and use print.
> printlevel := 1;
> interface(verboseproc=3);
>
> print(isprime);
> print(ifactor);
Finally the function showtime() allows will tell you how long a function takes to perform.
> showtime();
O1 := isprime((2^(2^11)+1));
time = 6.29, bytes = 22887974
O2 := isprime(2^(2^11)+ 7);
time = 2.68, bytes = 29854
O3 := isprime(2^(2^11) +2);
time = 0.00, bytes = 5454
O4 := off;