Ваші коментарі
After converting the string I check for primality. For VPA I first take the square root and run a while loop to check each odd modulus up to the square root (this is significantly faster that the isprime function). The total time for this is 8.3 seconds (2.4 seconds to convert, 4.8 for sqrt, and 1.1 for modulus loop). When I use Multiprecision I can skip the square root and use the isprime function which results in a time of 10.6 seconds, 9.9 seconds of which is conversion. The numerical calculations with mp are significantly faster that vpa, but the overall time is still longer due to the conversion.
Служба підтримки клієнтів працює на UserEcho
The newest version of mp appears to be ~25 times faster than the old version of mp and ~7 times faster than vpa. Thank you for such a quick fix.