How to get decimal form of largest known prime?

Daniel Yoo dyoo at hkn.eecs.berkeley.edu
Thu Jun 10 18:42:11 EDT 2004


: : According to latest news the largest known prime is:
: :                  2**24036583 - 1
: : (right?)


: Let's see... how many digits would it be?

: ###
:>>> def digits(n):
: ...     return int(math.log(n) / math.log(10)) + 1
: ...
:>>> x = 2**2436583 - 1
:>>> digits(x)
: 733485
: ###

: Ok, that doesn't sound too bad at all.  It's about 750,000 digits long.


Yikes.  I introduced an order-of-magnitude bug when defining x.  Let
me recalculate that:

###
>>> x = 2**24036583 - 1
>>> digits(x)
7235733
###

Ok, so there's about 7 million digits in that thing.  Slightly more
difficult to print out.  *grin*


My apologies for the mistake!



More information about the Python-list mailing list