Re: Beating C++ std::gcd
"Ruud H.G. van Tol" <[email protected]>
| Newsgroups | gmane.comp.mathematics.pari.devel |
|---|---|
| Message-ID | <[email protected]> |
To get the "real" (dx, dy), run it as % ./ts -v 37 A good part of the fun was, to move the circle as little as possible. -- Ruud On 2026-08-10 00:29, Ruud H.G. van Tol wrote: > Also see https://oeis.org/A295344/a295344.svg > for an alternative presentation. > > > On 2026-08-09 17:11, [email protected] wrote: >> Interesting. >> >> I did let it run and stopped execution after output of the a(37) >> coordinate line after 6.5h runtime on AMD 9950X CPU. >> >> I did want to look at it, and recently gemini did good jobs for me >> for similar tasks with python scripts and matplotlib. >> >> This time I asked for HTML page with JavaScript and SVG: >> https://share.gemini.google/HWG4yAgIxW74 >> >> Impressive what beautiful result a 544 character prompt instruction >> plus the computed log data returned: >> https://stamm-wilbrandt.de/A295344.gp.html >> >> Now it is a pleasure to step through the different circle radius >> solutions, there is a movie mode as well. >> >> Regards, >> >> Hermann. >> >> On 2026-08-09 05:48, Ruud H.G. van Tol wrote: >>> On 2026-08-08 13:51, Ruud H.G. van Tol wrote: >>>> In a project I'm working on, I measured that about 25% of its >>>> runtime was spent in gcd. >>>> The program runs with 10 threads, on a MacBook M1 Max. >>>> >>>> On my clang, std::gcd came out as the best suited implementation. >>>> Then I started looking for more speed, and tried a lookup table for >>>> smaller values. >>>> And that made it 20% faster! >>>> gcd(a, b); 0 <= a <= 511; 0 <= b <= 1023. >>> >>> It is used in this project: >>> >>> https://oeis.org/A295344/a295344.gp.txt (GP code) >>> https://oeis.org/A295344/a295344_1.cpp.txt (C++ code) >>> https://oeis.org/A295344/a295344_7.txt (example of output) >