How to get decimal form of largest known prime?

Rick Holbert holbertr at dma.org
Fri Jun 11 08:36:05 EDT 2004


So, something like this?

x = 2**2436583 - 1

while x > 0:
    print x%10,
    x/=10

Aahz wrote:

> In article <40c8e44f$0$36860$e4fe514c at news.xs4all.nl>,
> Irmen de Jong  <irmen at -nospam-remove-this-xs4all.nl> wrote:
>>Daniel Yoo wrote:
>>>
>>> >>>x = 2**2436583 - 1
>>[...]
>>
>>> >>>(x / 10) % 10
>>> 
>>> 0L
>>> ###
>>> 
>>> At least we can figure out that the number ends with a '07'.  If we
>>> continue this way, we can quickly get the other digits.
>>                             ^^^^^^^
>>Sadly, no you can't. Just try it ;-)
>>
>> >>> i=1
>> >>> while True:
>>...  print (x/i)%10,
>>...  i*=10
>>...
>>7 0 4 9 6 9 5 4 4 4 1 8...... slower and slower.....
> 
> You should perform destructive division.

-- 
o




More information about the Python-list mailing list