Message259421
Jurjen, this is very nice! -- Like Mark, I'm not sure if this should be in CPython.
Decimal (Python >= 3.3) has sneaked in a couple of fast bignum
algorithms, so calculating and converting the latest Mersenne
prime takes a couple of seconds:
from decimal import *
c = getcontext()
c.prec = MAX_PREC
c.Emax = MAX_EMAX
c.Emin = MIN_EMIN
x = Decimal(2)**74207281 - 1
s = str(x)
assert s[:12] == "300376418084"
assert s[-12:] == "391086436351" |
|
Date |
User |
Action |
Args |
2016-02-02 19:10:40 | skrah | set | recipients:
+ skrah, jneb, mark.dickinson, serhiy.storchaka |
2016-02-02 19:10:40 | skrah | set | messageid: <1454440240.68.0.839073260237.issue26256@psf.upfronthosting.co.za> |
2016-02-02 19:10:40 | skrah | link | issue26256 messages |
2016-02-02 19:10:40 | skrah | create | |
|