67x speed up using optimized C code

American Citizen <[email protected]> Mon, 6 Apr 2026 18:09:49 -0700
Newsgroups gmane.comp.mathematics.pari.user
Message-ID <[email protected]>
To all:

I am doing a serious search for the third Heron triangle with 3 square 
sides. Currently I know that the smallest side > 217277^2. Quadrillions 
of triangles are being searched.

I utilized both Claude Ai and Gemini AI to look at my current gp pari 
program trying to find 2 square sided Heron triangles quickly

While Claude derived the c-code from my pure GP Pari script file, Gemini 
AI stated that serious flaws existed. I was able to obtain the improved 
c code using the gmp library after Gemini fixed these problems (lesson, 
don't trust AI implicitly)

The execution time for c = 1853 went from 32+ seconds to 467 
milliseconds, an approximate 67x speedup.

Why am I posting? I believe that all of us need to know how to optimize 
our code and we need to know how to successfully utilize AI to do that. 
AI needs to be kept on a very tight leash, but for this example, I did 
observe an astonishing 67x increase.

Randall