benchmarking some AI

90 views
Skip to first unread message

Ruud H.G. van Tol

unread,
Jul 19, 2026, 7:18:26 AMJul 19
to seq...@googlegroups.com

I'm currently using A295344 "Find the maximum number of lattice points
covered by a circle of radius n"
to make AI to write decent code (Python, PARI/GP) that generates the
sequence.

I'm forcing it to only use "exact integer/rational/quadratic-surd
arithmetic" and "linear lookups", so "no Pi, no floats, no
floor()/ceil(), no approximation, no brute-force."
Any (potentially irrational) coordinate value is represented as
A+B*sqrt(D), which in the end gets presented in clean canonical form.

The current state is very verbose. It takes a few minutes to generate
200 terms.

I'm not yet at the phase where I will go through the code in detail,
throw away 90% of the lines, make it cache intermediate results, and let
the AI-tool restart from that.
I generally need to do that as an important step, possibly multiple times.
With my projects so far, in the end, the AI-tool never contributed much,
but mostly only was a good typing assistant, which is good enough for me.

-- Ruud

P.S. relevant YT-video: https://youtu.be/fdbXNWkpPMY
TL;DR: Arguing with an AI-tool, is counter-productive and costly.

brad klee

unread,
Jul 19, 2026, 10:04:13 AMJul 19
to seq...@googlegroups.com
On Sunday, July 19th, 2026 at 6:18 AM, 'Ruud H.G. van Tol' via SeqFan <seq...@googlegroups.com> wrote:
>
> I'm currently using A295344 "Find the maximum number of lattice points
> covered by a circle of radius n" ... It takes a few minutes to generate
> 200 terms.
>

Thanks, this is a good test case relevant to the other discussion as well.

Harm.On.ica S-O-L 5.6 Light already remembers enough about Artifact 11 from
the Disk Polyomino job that this is pretty much a one shot.

A similar algorithm fixes the radius thus eliminating the need to scan
through a pencil.

I don't think my time statistics were much better or worse than yours on
Intel Ultra 5 125U (14) @ 4.300G using one core without parallelization.

If you want to compare terms or times, the artifact extraction is here:

https://github.com/bradleyklee/Artifacts/tree/main/20-points-contained



All the best,






--Brad














Ruud H.G. van Tol

unread,
Jul 28, 2026, 3:07:34 AM (9 days ago) Jul 28
to seq...@googlegroups.com


On 2026-07-19 13:18, 'Ruud H.G. van Tol' via SeqFan wrote:
> I'm currently using A295344 "Find the maximum number of lattice points
> covered by a circle of radius n"
> to make AI to write decent code (Python, PARI/GP) that generates the
> sequence.
>
> I'm forcing it to only use "exact integer/rational/quadratic-surd
> arithmetic" and "linear lookups", so "no Pi, no floats, no
> floor()/ceil(), no approximation, no brute-force."
> Any (potentially irrational) coordinate value is represented as
> A+B*sqrt(D), which in the end gets presented in clean canonical form.
> [...]

After a little over a week of many hours per each and every day, as I am
only an amateur in this field, I arrived at a good point to soon call it
done, which in reality generally always means for me that it goes on the
back burner.
I'm still editing the related sequences (A295344, A123690, A291259), and
am testing and cleaning up the final gp-file (v20, as it looks now).

I'll attach to this message an .md-file with a concise description of
the TriangleSweep algorithm that is used.
Whether it is in any way new, or the Chinese already had it in their
toolbox 3 millennia ago, I have no idea, again.

Have fun chewing on it!

-- Ruud
triangle_sweep_algorithm.md

brad klee

unread,
Jul 28, 2026, 9:12:11 AM (8 days ago) Jul 28
to seq...@googlegroups.com
> Whether it is in any way new, or the Chinese already had it in their
> toolbox 3 millennia ago, I have no idea, again.

Harm.On.ica chewed it for a few minutes, and thinks that it is at
least substantially different from what I did. Harm.On.ica also
said that our algorithms are in the same O(n^2 log n) class.

Again, that's a claim, for what it's worth, and not something I've
verified or even tested.

I'm more involved with similar A147680 Circular Disk Polyominos.
Testing supports the claim that we've obtained a better asymptotic
class than the competitor Martin Fuller.

What I did for fairness sake is convert Martin's python code to C++
and run tests against my AB-scan and B-scan code.

The AB-scan looked to have comparable times, but was already faster
than Harm.On.ica's transcription of Martin's code.

The B-scan should be expected to improve asymptotic complexity, and
it was tested or observed to do so.

I don't know how long Martin spent to tabulate the 1000 terms, but
the B-scan algorithm in c++ gets the same terms in 6m on one core
at 4.3GHz.

Anyways, congrats on your code, but this thing about neolithic
China sounds possibly delusional.

What was actually written down "3 millennia ago"? Do you have a
reference? Is it something esoteric and secretive about jade knives?



All the best,






--Brad



























Charles Greathouse

unread,
Jul 28, 2026, 1:19:02 PM (8 days ago) Jul 28
to seq...@googlegroups.com
What was actually written down "3 millennia ago"?

I’m not really following the conversation, but you might be interested in
which shows that counting, squares, cubes, and first attempts at Pi were around that time.


--
You received this message because you are subscribed to the Google Groups "SeqFan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to seqfan+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/seqfan/bBbp3b64UCeLPHRxQjcJVbPTOhElwpO4Hvt0IIN2XAmv98Ere8ES4BMFILy7nMx8mEiD1gG9klP3nSRpwRxue8JV3bsO0FgopYXKAPZ6ZdQ%3D%40proton.me.

Dario Clavijo

unread,
Jul 28, 2026, 2:48:26 PM (8 days ago) Jul 28
to seq...@googlegroups.com
Hello

Just curiosity

Why historical sequences have all low A numbers?

Meaning the highest number I could find was A239132.

El mar, 28 jul 2026 a las 14:19, Charles Greathouse
(<crgrea...@gmail.com>) escribió:
> To view this discussion visit https://groups.google.com/d/msgid/seqfan/CANXmBjyxaXUg3hcchvcZFhOtCz8341J4Bpsj4PKKZy9-0UPA8w%40mail.gmail.com.

Allan Wechsler

unread,
Jul 28, 2026, 3:21:31 PM (8 days ago) Jul 28
to seq...@googlegroups.com
Dario,

The A numbers have no mathematical meaning -- they are just assigned in the order that sequence entries are created. In fact if you want a rough introduction to the most basic sequence concepts, you could do worse than look at the early sequences in A-number order -- you will tend to see important, long-understood concepts first. Of course there are exceptions, but the A-numbers are mostly arbitrary artifacts of history.

-- Allan

Dario Clavijo

unread,
Jul 28, 2026, 10:58:37 PM (8 days ago) Jul 28
to seq...@googlegroups.com
My thought was that they were correlated with time since it tends to
increment, yes i'm taking into account that sometimes some A numbers
get recycled.
> To view this discussion visit https://groups.google.com/d/msgid/seqfan/CADy-sGESDTVPwD1Uo9qD6%2B%3DCsFQzTurzx-o4CjL36h9zp7-Tyg%40mail.gmail.com.

Charles Greathouse

unread,
Jul 31, 2026, 4:54:25 PM (5 days ago) Jul 31
to seq...@googlegroups.com
Maybe we’re missing some from newer submissions?

Reply all
Reply to author
Forward
0 new messages