How to get decimal form of largest known prime?

Aahz aahz at pythoncraft.com
Fri Jun 11 01:30:16 CEST 2004


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.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"as long as we like the same operating system, things are cool." --piranha



More information about the Python-list mailing list