I found out yesterday that there is a conjecture that the following function generates an addition chain: $f(n)=\pi({n(n+1)\over 2}+1)$ for and integer $n\ge 1$. $\pi(x)$ is the prime counting function. So the addition chain part requires:
$f(x) =\begin{cases}1 & \text{if }x=1\\f(y)+f(z) & 1\le y,z<x\end{cases}$
Slide 27 in https://static.uni-graz.at/fileadmin/veranstaltungen/additive2016/Talks/sun_zw_slides.pdf
says that this has been verified for $f(n), n\le 10^5$
I put together some code to map a file and verify the addition chain conditions. After some minor playing I got this running very fast. This is a strange addition chain in that it doesn't grow very fast unlike the normal chains I deal with. So you get extreme non-star steps (these are steps were $f(n)\ne f(n-1)+f(m)$ for any $m<n$. For example $f(877591)=f(693121)+f(518832)$.
The rate determining step then is outputting the PrimePi values. I am just looping over increasing $n$ writing to a binary file for each result.
I have done so far $n\le 1813748$ running overnight. Reading PrimePi doc I don't see anything on performance. I see different algorithms but nothing on what works best for repeated calls. Maybe one call with a very large value primes the pump etc? PrimePi is using all 64 cores completely. Can I get these values faster some way?
RiemannR? See: Approximation to the prime counting function – MarcoB Jan 25 '24 at 20:59PrimePiusesprimecount, a highly optimized routine for the prime counting function. You may be able to squeeze some more performance by using the utility directly and making your own lookup table. Maybe. – MarcoB Jan 25 '24 at 21:08