| Ruud H.G. van Tol on Mon, 10 Aug 2026 00:29:55 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: Beating C++ std::gcd |
Hello Hermann, Also see https://oeis.org/A295344/a295344.svg for an alternative presentation. -- Ruud On 2026-08-09 17:11, hermann@stamm-wilbrandt.de 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/HWG4yAgIxW74Impressive what beautiful result a 544 character prompt instruction plus the computed log data returned:https://stamm-wilbrandt.de/A295344.gp.htmlNow 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)