Is Mathematica really slow?
M[p_]:=2^p1
LL[p_]:=Module[{s,c,counter},
If[PrimeQ[p]==False,Print["The exponent must be prime"]];
s=4;
c=M[p];
counter=0;
iter=p1;
Print["Iteration : 0 "," / ",iter];
For[i=1,i<iter,i++,
s=Mod[s^22,c];
counter++;
If[Mod[counter,10^3]==0,Print["Iteration : ",counter," / ",iter]]
]
If[s==0,Print["is prime"],Print["is not prime"]]
]
' Test run '

LL[11119]//Timing
Iteration : 0 / 11118
Iteration : 1000 / 11118
Iteration : 2000 / 11118
Iteration : 3000 / 11118
Iteration : 4000 / 11118
Iteration : 5000 / 11118
Iteration : 6000 / 11118
Iteration : 7000 / 11118
Iteration : 8000 / 11118
Iteration : 9000 / 11118
Iteration : 10000 / 11118
Iteration : 11000 / 11118
" is not prime"
{15.112 Second,Null}
Hello,
I was experimenting with Mathematica v5.0 about the Lucas_Lehmer test.
As you can see above the code is extremely slow. It needs 15+ sec
to test the exponent where as Prime95 only takes about 0.5 sec.
Can someone explain why is this happening because as far as I am concerned Mathematica is believed to be one of the fastest numerical computing platforms.
Any help would be grateful.
