/* Copyright (C) 2019 Alessandro Languasco */ /**************** A. LANGUASCO ******************** ************* COMPUTATION OF THE EULER KRONECKER CONSTANTS MOD q(PRIME) *******/ /* Here we compute the values of -T(a/q) */ /***************** Precomputations for the external C program ****************/ \\ \p needed to decide the precision default (format, f) for the floating point {precT(x,y)= local(vec, aoverq, q, g, a, minutes, millisec, seconds, elaptimeprecomp, Tfile, tab,name, namefile); default(format , f); \\ print numbers with floating point notation (not E notation) vec = readvec("./primroot.res"); \\getting q and g from primroot.res q=vec[1]; g=vec[2]; \\ print(q);print(g); print("Precomputation T-values for q = ",q, " and saving on file"); tab=sumnuminit(); \\ needed for the sumnum function if (x<0, x=0); \\ needed to avoid problem with the first interval if (x>=y, error("first exponent should be less than the second")); if (y>q-2, y=q-2); \\ needed to avoid problem with the last interval name="./precomp_T-"; namefile = Strprintf("%s-%012d-%012d.res", name, x, y); Tfile = fileopen(namefile, "w"); if (x==0,filewrite(Tfile,q)); gettime(); a=g^x%q; for(k=x, y, aoverq = a/q; \\ already sorted for the final summation in external program filewrite(Tfile,sumnum(m=0, (log(aoverq+m)/(aoverq+m))-(log(1+m)/(1+m)),tab)); a=(a*g)%q; \\a=g^k%q; ); elaptimeprecomp=gettime(); fileclose(Tfile); /* print computation time */ seconds=floor(elaptimeprecomp/1000)%60; minutes=floor(elaptimeprecomp/60000); millisec=elaptimeprecomp- minutes*60000 - seconds*1000; \\print(elaptimeprecomp); print("Precomputation time (I/O included): ", minutes, " min, ", seconds, " sec, ", millisec, " millisec"); } /************************************ DA FARE SU OGNI MACCHINA (le librerie create da gp2c dipendono dalla macchina che si usa) air:Desktop languasc$ gp2c-run -pmy_ -g -W precT.gp per creare le librerie .so e il file .gp2c *******/