GMP used during 3 and a half years to solve MIT's LCS35

Bernard Fabrot bfabrot at gmail.com
Wed May 8 15:46:28 UTC 2019


Re all,

I'm back from vacation.

If anyone could test this on an older GMP version / older hardware it would
be amazing.  Actually tests on more recent hardware (like i9 or AMD) would
be great too.

That'd be 40 million iterations. It's from someone on mersenneforums (in a
recent thread discussing the solution to LCS35 I found) and contains two
tests (my code doesn't have any benchmarking in it and ain't as clean: it
has all the code related to creating backup files with the intermediate
results so that I could resume the computation).  On Core i7 CPUs it takes
very roughly from 50 seconds to 30 seconds for the 100 m iterations.

I'm preparing the slides for the ceremony on the 15th and it'd be great if
I had some numbers on less powerful / older machines.

I don't know how the mailing list works so I paste the short code here
below and also attach it to this email.

No biggie if nobody has the time to try this.


#include <stdio.h>
#include <time.h>
#include "gmp.h"

int main(void){

    mpz_t n,r,two1000;
    char
w[]="6314466083072888893799357126131292332363298818330841375588990772701957128924885547308446055753206513618346628848948088663500368480396588171361987660521897267810162280557475393838308261759713218926668611776954526391570120690939973680089721274464666423319187806830552067951253070082020241246233982410737753705127344494169501180975241890667963858754856319805507273709904397119733614666701543905360152543373982524579313575317653646331989064651402133985265800341991903982192844710212464887459388853582070318084289023209710907032396934919962778995323320184064522476463966355937367009369212758092086293198727008292431243681";

    mpz_init(n);
    mpz_init(r);
    mpz_init(two1000);

    gmp_sscanf(w,"%Zd",&n);
    gmp_printf("Read n=%Zd has %d bits.\n",n,mpz_sizeinbase(n,2));

    time_t sec=time(NULL);
    long long int i,it=40000000;

    mpz_set_ui(r,2);
    for(i=0;i<it;i++)mpz_powm_ui(r,r,2,n);
    gmp_printf("answer 1=%Zd\ndone %lld iterations in time=%ld
sec.\n",r,it,time(NULL)-sec);


    sec=time(NULL);
    mpz_set_ui(r,2);
    mpz_ui_pow_ui(two1000,2,1000);
    for(i=0;i<it/1000;i++)mpz_powm(r,r,two1000,n);
    gmp_printf("answer 2=%Zd\ndone %lld iterations in time=%ld
sec.\n",r,it,time(NULL)-sec);

    mpz_clear(n);
    mpz_clear(r);
    mpz_clear(two1000);
    return 0;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lcs35perfs.c
Type: text/x-csrc
Size: 1436 bytes
Desc: not available
URL: <https://gmplib.org/list-archives/gmp-discuss/attachments/20190508/62033f6f/attachment-0001.bin>


More information about the gmp-discuss mailing list