--- In

primenumbers@yahoogroups.com,

"rach" <maths_forall@...> wrote:

> http://www.1athlet.com

For odd n > 1, the application computes the order

of 2 modulo n by the following very slow method:

ord(n)=local(m=n,c);while(m,c++;m=(m+if(m%2,0,n)-1)/2);c;

With n = 8988229, it took 8 seconds:

gettime;print(ord(8988229)" in "round(gettime/10^3)" seconds");

8988228 in 8 seconds

By comparison, Pari-GP's "znorder" is 500000 times faster,

as I here show by computing the order 1000 times:

gettime;for(k=1,1000,ans=znorder(Mod(2,8988229)));

print(ans" in "gettime" microseconds");

8988228 in 15 microseconds

Here is a test that the slow method works up to n = 33333:

forstep(n=3,33333,2,if(ord(n)!=znorder(Mod(2,n)),print(n)));

[the rest is silence]

David