08/07/2014, 01:34 AM

(08/07/2014, 01:19 AM)jaydfox Wrote: Alright, here's the first draft of PARI/gp code. Note the use of a constant V0 in my array indexes. Converting code from a typical language with 0-based arrays, to a language like PARI with 1-based arrays, can be very difficult to debug. So I took the easy way out and made all the code implicitly 0-based, using the V0 constant to add the 1 back in at the last moment. This allows me to port code back and forth between PARI/gp and SAGE/python or c++ or whatever.Okay, first of all, I didn't make all the arrays 0-based with the V0 trick. Just in the sections of code I was porting directly from SAGE/python, which I had written and debugged in SAGE. Other sections of code (like the NextSeq function), which I wrote from scratch in PARI/gp, don't use the trick. I just wanted to point that out, in case I confused anyone.

Also, please note that when the polynomials are being printed in the InitPolys function, they are rescaled to match my previously posted polynomials. However, "under the hood", the polynomials are scaled properly. Just check out the SeqNum list to see the unscaled polynomials.

By the way, now that the code is finally written in PARI/gp, I took the opportunity to calculate the 2^99th element. (Note that a degree 100 polynomial only gets us up to 2^99. A very small tweak to the code will get the 2^100th element, so I'll be sure to include that in the next version.)

It took just 2.5 minutes to calculate the polynomials, about twice as fast as SAGE/python, if I recall correctly. Not sure why the difference, but I'm not complaining:

~ Jay Daniel Fox