PARi code is so similar to C code that it is translated practically "in mind". With a couple of exceptions, which do not affect the logic of the work and are easily replaced by C code.
Agreed, but it is the exceptions that are the issue. I don't know any of the vector commands from when I used to use PARI some 15 years ago, and I see an occasional comment from you (such as about "p++") that suggest that there are "false friends" - constructs that look identical but are not.
But as I said, it is obvious enough what the logic should be, and much of the detail already exists in useful forms within pcoul.
Цитата:
I think it is likely it will be able to reach 1e7, but I'm not sure: I need more work on extrapolating the rate of calculation, which has not proven to be as simple as I expected.
The usual quadratic dependence: each halving of the threshold takes twice as long as the previous one.
That is what I had assumed, but it turns out not to be as simple as that. I think changing density of primes for each of
probably also affect the rate.
I tried putting data from my logs into an online curve-fitting program, and it proposed the following (which looks nonsensical to me):
Код:
y = -449219.45 + x / (-142.48 - .000002635 x + 0.0511 sqrt(x))
.. where
is the starting prime, and
is how far that should be reduced in 10 minutes of work.
If I believe that, it should take 5 days to reach 1e7.
Цитата:
All this mess with -g is not really needed at all: at start it is possible to measure real speed of search at approximate expected (plus or minus several times) point of mode change and then measure time of recursive search, as soon as it becomes more than estimated time required for linear search - to stop recursion and to finish by counting linearly. That's all there is to it. And don't suffer defining the perfect -g.
Deciding what is the "approximate expected point of mode change" is itself not trivial; if we get it wrong then the step "measure
real speed of search" may take days instead of seconds. We also do not want to test this repeatedly at every level of recursion, but a decision when to change mode must be made at every level - imperfect as it is, that is the role that g plays.