How to get decimal form of largest known prime?

Grégoire Dooms dooms at info.LESS.ucl.SPAM.ac.be
Sat Jun 12 07:59:02 EDT 2004


Claudio Grondi wrote:
> If  I understand right all your responses
> there is no way to get the decimal form
> of the prime within let me say minutes?
> Any other ideas how to get it similar fast
> as the hexadecimal form?
> 
If speed is the matter, go for C:

with the GNU MP library use
void mpz_pow_ui (mpz_t rop, mpz_t base, unsigned long int exp) and
char * mpz_get_str (char *str, int base, mpz_t op)

I did a small contest about the decimal repr of 2**1000000 a a couple 
years ago. A few languages were compared on a time-to-result basis.
Python won with 7 minutes (10 sec devel, 6:50 comput.) and
C + GMP was second: 15 min devel(including reading the doc) + a few sec 
of comput.
I bet you can expect a 30-100 fold speedup using C + GMP compared to 
python -c 'print 2**24036583 - 1'

If you try this approach I'd like to know which results you get.

--
Grégoire Dooms



More information about the Python-list mailing list