On Sunday 29 June 2003 03:24, Brian J. Beesley wrote:
> I don't know offhand, but:
>
> (a) Python is interpreted;
>
> (b) the Python interpreter is open source, so it shouldn't be hard to find
> out how it does big integer arithmetic;
>
> (c) you might also look for a dependence on the GNU multi-precision library
> (GMP) since that is an obvious candidate;
>
> (d) whatever method it's using doesn't seem to be very efficient - you have
> been running for 10 days to execute something which mprime/Prime95 would
> accomplish in a small fraction of a second.

I had the program output the time it took instead of the result of squaring. 
It quadrupled each time after the 10th iteration, which means it's doing 
shift-and-add the same way any child learns to multiply big numbers. I'm not 
going to try dealing with roundoff error in FFT to square a number that's a 
different size each time, so I'll just code up the method that triples the 
time each iteration ((ax+b)^2=a^2*x^2+b^2+(a^2+b^2-(a-b)^2)*x). That'll be 
fast enough for something that only occasionally produces a big number.

phma 
_________________________________________________________________________
Unsubscribe & list info -- http://www.ndatech.com/mersenne/signup.htm
Mersenne Prime FAQ      -- http://www.tasam.com/~lrwiman/FAQ-mers

Reply via email to